How do you build extensible data model

前端 未结 5 533
离开以前
离开以前 2020-12-16 07:30

I\'m thinking of building a ecommerce application with an extensible data model using NHibernate and Fluent NHibernate. By having an extensible data model, I have the abilit

5条回答
  •  情话喂你
    2020-12-16 08:14

    I think this link describes kind of what you want...

    http://ayende.com/Blog/archive/2009/04/11/nhibernate-mapping-ltdynamic-componentgt.aspx

    More info on dynamic-component:

    http://www.mattfreeman.co.uk/2009/01/nhibernate-mapping-with-dynamic-component/ http://bartreyserhove.blogspot.com/2008/02/dynamic-domain-mode-using-nhibernate.html

    The idea behind dynamic-component is that you can build your data model by not having a one to one mapping of databse columns with properties. Instead you have only a dictionary property that can contain data from as many properties as you like. This way when you fetch the entity, the dictionary gets the data of all columns configured to belong in there. You can extend the database table's schema to include more columns and that will be reflected to the databse model if you update the mapping file accordingly (manually or though code at application start).

    To be honest I do not know you can query such entity using the "attributes" property but if I had to guess I would do an IN statement to it.

提交回复
热议问题