Search code examples
sqlwcfsql-server-2008entity-frameworkwcf-ria-services

How to generate an EntityDomainModel from C#


I am making an app that lets user define their own data source (SQL), define the data attributes for the tables and what not, from a nice UI, and then expose a service for that data. Since the tables are generated dynamically, via my UI, I want to be able to also generate a DomainModel and a DomainService that would make this data available to whatever needs to subscribe to it.

Think of it as the following scenario: An online store needs to define the attributes of different products. The attributes need to be queryable and stored separately in their own field. The online store's UI also needs to be able to get and display those products, query the products and so forth.

Is this possible to be done?


Solution

  • In you online store scenario without letting user to create tables by introducing their own attributes you can have a separate attribute tale for that,

    Product-
          -Name
          -Price
          -----
    
     ProductAttribute-
            -Name
            -DataType
            -Value
    

    Product will have many product atributes and you can let user to add new attributes. So it will be adding a new row to the Product Attribute table. You do not need to let user to create tables.