This project is read-only.

when to use content types

Topics: Writing modules
Mar 2, 2011 at 5:28 PM

Example: The content type "Comment" in Orchard.Comments.

Is there a specific reason why it is a Content Type and not just a pure record based data storage? Is there anything which would not be possible when it would not be a content type?

Mar 2, 2011 at 6:25 PM

Yes: this way, it's extensible. You could for example add a gravatar part to the comment type without having to touch the existing one. We are also getting lots of benefits internally from this type of unification.

Mar 2, 2011 at 9:03 PM

This sounds reasonable.

But looking at the code this currently is theory, isn't it? Because I found no reference to the Comment content type (despite for using it to create a new CommentPart) at all. Most at the time only CommentPart is being used for plain data access -- there is no shape related to CommentPart; the CommentPartDriver does nothing.

But maybe I just missed a detail -- the framework is so huge and the more details I come across the more things I thought I did have understood are starting to confuse me. [I have no clue how I would "render" a content type instance or just even a content part instance since they are not rendered at once but just create 1 or more shapes which get (or get not) positioned by the file into the content layout area.]

Mar 2, 2011 at 11:28 PM

No, it's not just theory: you could add your own parts or fields and make that work. You are right that the current implementation is taking a short-cut here that it probably shouldn't in that it assumes that comments are always going to be displayed as a list by the Comments part so you'd have to modify that big template.