views:

109

answers:

1

Does anyone have any recommendations for dealing with user-defined data structures? i.e. your users have to be able to define extra fields, and sometimes tables, to associate with the 'fixed' entities in your system. I always seem to be unlucky enough to end up working on projects where this is a major component. Normally the solution ends up being dynamically generated SQL tables, with some terrifying SQL generation tacked on around the edges of the ORM to load and save the dynamic data.

There HAS to be a better way of dealing with this, if you've tackled this sort of thing before, how have you managed to get the dynamic part of your model to play nicely with an ORM? Is it fairly standard to generate tables on the fly to store the data, or is it preferable to use something like a big name/value table?

From a performance standpoint, the type of projects I'm thinking of are not hugely demanding in terms of insert/update speed, but need to be responsive when querying and reporting across large volumes of data (especially filtering and aggregating against the dynamic fields).

+1  A: 

Not sure what ORM is but I think I understand what your asking.

For customer extended data in systems like this application I have made store the data in an Xml field in the database and the client side object store as XmlDocuments. The Xml fields in SQL server are easily queried and my object classes wrap the custom Xml data.

Kelsey
Sounds like a really nice approach, much more controlled than name/value pairs but without the horror of dynamic table creation! Will look into this, wonder how it will integrate with LINQ to SQL (or NHibernate). Thanks!
Jon M