Vulnerability in EPiServer.Forms
Is it possible to search for all pages in EPiServer implementing an interface? Without EPiServer Find?
private void FindAllPages(List<ContentReference> list, ContentReference parentPage)
var loader = ServiceLocator.Current.GetInstance<IContentLoader>();
var children = loader.GetChildren<PageData>(parentPage);
if (pg is ISampleInterface)
var list = new List<ContentReference>();
An alternative soultion could be to first iterate over all ContentTypes returned from IContentTypeRepository.List and get those contentTypes where ModelType is assignable to the interface.
Then for each ot the content types found above call IContentModelUsage.ListContentOfContentType
Note that both my suggestion and Valdis suggestion (which also have the consequence that it will load up all pages to the cache) might take a considerable time to execute (especially for large sites). So if it is acceptable for the customer you should consider caching the result and then perhaps have a background timer or scheduled job that periodically updates the cached result.
Valdis recursive search works, but it does take some time to execute, guess I'll have to cache it :)
Nobody said it will come at no cost :)