none
What is the best way for creating dynamic properties for an entity? RRS feed

  • Question

  • Hi

    I need to create a Dynamic Properties model for a specific entity, for example:

    [Costumer ]  => [PropertiesxCostumer] <=  [Properties]

    [Costumer]
    Id
    Name
    Telephone
    Email

    [Properties]
    Id
    PropertyName
    PropertyType

    [PropertiesxCostumer]
    IdCostumer
    IdProperty
    Value

    This model is good, but as I am using an ORM is very complicated for this model to generate dynamic reports without generating complex StoredProcedures with many transactional load.

    I need to give the possibility to diferent users to create reports with this columns

    Costumer, PropertyName1, PropertyName2, ... PropertyNameN

    Converting the rows in a dynamic table to columns is a complex proccess that only could be done in the DataBase with a SP (as far as I know) or programatically, but the performance in booth cases is not so good and those reports will have to be out of the ORM model, because the Shceme is not always the same, each user will define his own properties for his own costumers, so the structure for his reports will be different to the others.

    My other option was to create an ExtendedProperties table with lots of columns, like 50 or 60 columnes, giving my client the possibility to use upt to that number of Extended Properties, but I was worried about creating 50 or 60 relations (With the FK, inxedes and all that implicates) because 

    I want to know what is the best way or the best practice for using ORM with this kind of situation


    SebaXOR

    Thursday, December 6, 2012 1:17 PM