Extend content types at runtime in the admin UI.

Topics: Core, Customizing Orchard, General
Jun 15, 2012 at 10:00 PM

My application requirements include a possibility for admin user to customize a fieldset of domain entities (content types?) just as in CRM Dynamics. What  is an Orchard way for persisting and rendering of such types if I don't know field names in advance?

Any guidance will be greatly appreciated.

Jun 15, 2012 at 10:03 PM

You can create content types and add fields and behaviors dynamically from the admin screen. In Content -> Content Types -> Create/Edit ...

Then you can use Queries and Projections to render them on the front end.

Jun 15, 2012 at 10:13 PM

Thanks for immediate response :)  and those leads. I hope to dive deeper and come back here again.

Jun 16, 2012 at 1:07 PM
Edited Jun 16, 2012 at 1:09 PM

I have other questions concerning persistence of my data. A number of my content types contain a base field set + set of admin added custom fields. I understand that all fields will be stored in XML columns in my DB.
My application should have advanced reporting capabilities so my concern is about performance of XML parsing.

1. Is there any noticeable performance difference in quering database columns and parsing (projecting) fields from XML?

2. Is it possible to store a base field set as a set of separate database columns and custom fields as XML column?

3. Is it worth to do that separation from performance point of view?

4. And is it feasible to combine a query to database  columns and burried inside XML fields in one report query?

5. Are there any considerations about content type (part) size. Is it better to wrap all custom fields into one content part or wrap a custom field per content part?

6. I want a user wouldn't be able to delete fields from a base field set but probably could modify some of them. How to archive that fine control?

Thanks in advance

Jun 17, 2012 at 10:36 PM

If you enable the Projections module, then all those dynamic data are indexed in database tables. The module uses them to create queries dynamically, but you could also use it for your reporting purposes.

Jun 24, 2012 at 2:47 PM

Thanks for the answer.

But I still have no idea if I need to create my base field set as Records and store my custom fields as XML columns only. Will it give any perfomance benefit for queries comparing with all dynamic fields case?

Second, do I understand right that Projections module deals with both Records and XML columns and a query can combine all field types (recorded and dynamic) in it?

Third, any thoughts regarding question 5 and 6 please.

Thanks a lot!

Jun 25, 2012 at 9:41 PM


Jun 27, 2012 at 9:54 AM

Could anybody shed a light please...

Jun 27, 2012 at 5:11 PM

You can create your base fields inside a single Part, taht you can weld to any of your content types.

Projections can mix records and field queries.

Don't make a part per field, unless it makes sense in terms of reusability.

You can control permissions at the fields level, just the content item level. It would need a specific custom Record and a Driver for that. It's completely doable by code then.

Jun 28, 2012 at 10:19 AM

Thanks a lot Sebastien!