1

I need to create several different modules, so I'm looking for the best approach to take and I'm hoping those in-the-know could offer some advice.

What I'm trying to achieve could theoretically be done using a mixture of ContentTypes, Fields, Taxonomies, Queries and Projections as provided with Orchard and its existing default modules.

However since I'm creating the module for an end-user without training or experience, I really need to simplify and hand-hold.

The module I write will be reused in the future, and I'd like the ability to add/remove fields quite easily.

I need to create an admin section separate from the Content manager to manage the module (for the ease-of-use bit).

It seems that the current practice is to create Parts with the inputs I require in the model and manually write out the Shapes etc as per the traditional MVC approach.

The question I'm asking is: would it be viable to use the Fields module to handle these inputs for me? Then I (believe I) can take advantage of the Shape rendering all ready-to-go as part of the Fields module (as I really love the Fields module and how extensible it is).

What are the key disadvantages of this approach?

I've tried to be clear without being too specific, but I am willing to provide more information if I haven't been.

1 Answer 1

2

I think being more specific here wouldn't harm. But to answer in the same manner:

Parts are even more extensible than fields and all of them are using shapes to build the layout (I'm not sure what you found in the Fields module that caught your attention and you think it is just possible with parts?).

However there are some key differences between parts and fields (and thus I think your question is rather how to model the data you want to store):

  • Parts can (but not necessarily should) correspond to database tables, i.e. a part can store its data in a table.
  • A field's data is stored along the content item's ContentItemVersionRecord in a serialized XML format (and is thus performing worse because of serialization but also better because of not having to join in or lazily load other tables; concrete performance difference depends on the usage).
  • Because of the storage difference parts' properties can be directly queried and used for filtering or ordering while fields can't be queried. The Projector module overcomes this by creating indices for fields.
  • Also having to do with storage a part can contain an arbitrary number of pieces of information while a field can only contain one (this is the field's value).
  • While a part can be attached to a content type once, a field can be attached multiple times.
  • Parts are attached to a content type while technically fields are attached to a part (when you attach fields to a content type from the admin UI in reality an invisible part, having the same name as the type, will be created).
3
  • What I liked about Fields is that all the Shapes and Drivers are already written, saving me work now and in the future when things change. But of course, this is only beneficial if it doesn't create too much extra work elsewhere. Your answer has given me plenty of information which has steered me in the right direction. I will create a hybrid, using fields for anything I don't need to query (which is most of them). Thank you very much @Piedone! Mar 17, 2013 at 23:51
  • 2
    Shapes and drivers are already written for parts too. Make sure to take your time with these concepts to fully understand them and play with Orchard to get the feeling. Glad I could help!
    – Piedone
    Mar 18, 2013 at 9:59
  • I've started on the simplest module and I'm starting to understand how all the pieces fit together, thanks again. Mar 19, 2013 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.