I have a page that has a contentarea that allows references to other pages. Specifically, I have a ClinicPage which has a ContentArea to hold ProviderPages, for each provider in the clinic. Providers can be in multiple clinics.
I'd rather not have to maintain this relationship in both directions by having a ContentArea on ProviderPage to hold the clinics, but I'd like the provider page to link to each clinic the provider is a member of.
How do I query EPiServer to find every clinic page whose contentarea holds a reference to the provider page?
If I understand your request correctly, you could check my blog for inspiration.
Note that The IContentRepository.GetReferenceInformationForContent method Alf referres to will not only capture references from ContentAreas, it will also capture references from e.g. XhtmlStrings, Url, ContentReference, ArchiveLink, ShortcutLink properties.
You could use EPiServer.DataAbstraction.ContentSoftLinkRepository.Load instead, that will limit the checks to custom properties (metadata properties are excluded). It will however also check custom XhtmlStrings, Url, ContentReference properties.
Cool Johan, thanks for the update. I'd better check on that and update the post.
What do you mean when you say metadata properties?
With metadata properties I mean all properties that you have not explicitly added to your model classes. That is properties inherited from baseclasses or interfaces (like, ContentLink, ParentLink, ContentTypeID, Language etc)
EPiServer.DataAbstraction.ContentSoftLinkRepository.Load has an overloaded method that takes a boolean parameter reversed. This can be used so you can either get "all content items that a specific content item references" or the other way around "all content items that references this specific content item"