ContentPart that is ONLY made up of other parts

Topics: Writing modules
Jul 26, 2012 at 7:24 PM

I'm trying to create a new ContentItem of a ContentType that is a ContentPart that only contains 3 other ContentParts, it does not have any properties of its own. So basically it's a record that ties 3 other records together.

I'm taking an "Specified cast is not valid" on the ContentManager.Create() method.

Do I need to model this ContentPart any differently when it's only made up of other ContentParts? Does it need to have at least 1 property to be able to create a ContentItem for it?


Jul 26, 2012 at 8:02 PM

No...apparently there's this requirement to have a Driver for your Part if you actually want to do something with it =) LOL

I somehow missed creating the Driver for this one...I even have a checklist that I go through as I'm creating new models. FAIL on my part.

Jul 27, 2012 at 1:37 PM

A part made up of parts? That sounds to go completely against the Orchard type system design, which uses composition at the type level. Why don't you simply make your type aggregate those three part?

Jul 27, 2012 at 7:05 PM are of course correct. This is just a bit of lazyness on my part at this point.

I need a record in a table for this, but it has no display purposes whatsoever. So, in theory, it shouldn't even be a Content Part or Content Type. BUT...since I'm rendering shapes of other Content Items based on the values in this table, I wanted to use the existing code conventions I have for Drivers to render the shapes instead of spending the time right now to write the code to generate the shapes directly from the controller (copy and paste are my friends right now).

I'll be changing this later so it's not a ContentPart.

Since this isn't a module for public use and a custom application that I'm developing, I'm taking a lot of liberties =)

Thanks for making sure I'm following the intended design pattern though...very much appreciated.