Now I am using another ORM and I am new to DataObjects. And I am thinking to make a switch. I have a social modelling idea, which is based on ORM. It means every user can add his own extra properties(columns) to the original object(data) model. And it is better if one user can then share such extra properties with others. The extra properties can be saved in the same data base or saved in another one and linked togather locally, which should be decided by end user. There is already a deep discussion, Yet another dynamic data model question… (http://stackoverflow.com/questions/2037 ... l-question). In the discuss, the participants focused on the backend, where to store the data. Their conclusion seems to be to use ESENT database, instead of a traditional RDBMS. I need a solution for traditional RDBMS, which is better to be built on a mature ORM, such as DataObjects. I am wondering whether DataObjects can do such a job. My idea is not very clear. So any comments are welcome. This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by thinkly. |
I quickly looked up the discussion @ StackOverflow. I'd also use a hybrid EAV data model of nearly the following structure for your database (bellow is "nearly C#" notation + few DO4 attributes):
Here I used automatic open generic instance registration to provide PropertyValue<t> counterpart for each hierarchy root implementing IHasCustomProperties (in particuler, Person). Having the following indexes on tables mapped to PropertyValue<t> type:
To avoid joins with table related to e.g. Person type, you can duplicate its properties in PropertyValue<person> and use them in queries. Obviously, byte[] Value implies some limitations:
|