This project is read-only.

ContentPart Inheritance

Topics: Customizing Orchard, General
Mar 18, 2011 at 3:51 PM

I want to create multiple widgets using the same content part. I basically want to use the same data, but display it multiple ways. However, if a content manager adds all of my widgets to one page, I don't want the content part data to have to be retrieved for each widget. I figured I could have each widget check if the data it's looking for is in the shape and not load it, but I can't figure out how I might execute this. Any pointers?

Mar 18, 2011 at 8:07 PM

You could cache it, either using our Cache APIs, or simply per request into HttpContext.Items.

Mar 23, 2011 at 1:51 PM
Edited Mar 23, 2011 at 1:51 PM

It depends what kind of part you have, is it a custom part?

I needed to show a user profile widget where each widget needed to show the UserProfilePart with the data from one profile record of the current user.
So instead of registering a StorageFilter<For>(standardRepository) i registered a specific userProfileRepository.

I think writing a own specific Repository (UserProfileRepository) is the best way to go, or else a own Generic SingleRecordRepository, that u can base it on a main contentItem.