Help laying out types "The Orchard Way" (When should I use a non-contentType over a ContentType?)

Topics: Writing modules
Nov 14, 2013 at 10:45 AM
Hi we're digging into Orchard and having a bit of trouble trying to figure out how we should architect our types within Orchard, we could hack this together but we've found that figuring out what "The Orchardy way" would be has already saved us time (like using the CustomForms module to quickly make forms from our set of Parts :) )

The biggest part is "When should things be a contentType or non content Record?"

The example that's tripping us up is when we're trying to reference a contentType from a record (I understand we can do this using the ContentManager.Get passing the Id of the contentType item in).

Here's a diagram that'll easier explain what we're trying to do:

The idea is to allow users to register a list of people for a course.

We thought that for things like Nominee, Course Attendance, Course Instance etc we could have them as non-content items as they aren't created directly, the controller behind the RegisterAttendees does that.

But a Nominee has the exact same fields as the CompanyDetailsPart + PersonalDetailsPart + ContactDetailsPart so we'd like to reuse those parts + the UI to represent the Nominee (we're making use of those parts in several places). Does this mean the Nominee has to be a ContentType to make use or the parts?

I think the hangup we have for representing everything as a ContentItem is we'd need to use the ContentPickerPart to represent the relationships, which is fne but is makes us ask this question:

If I display the Nominee (which has our custom parts containing string fields, and a ContentPickerPart, it shows the ContentPickerUI automatically, can we prevent that from happening? What if in the Nominee view we want to have validation on the PersonalDetailsPart but not when it's used somewhere else?

I know this is a lot to ask about, we're reading and watching a lot of great content and I think if there's an answer for this in googleable form it'll help others quickly get a sense for how to lay things out in Orchard.

Thanks in advance,