none
leting user to declare an entity type RRS feed

  • Question

  • I have a property like this:

    public List<Type> varname;

    and inside the Type I have a property that I want my users declare its type.

    The only clean solution that I could've think of was using interface as my Type and then with that interface I could access a generic class which then I could let my user to declare the generic type but since entity framework wont accept interfaces as type of an entity I should think about another solution.

    so I was wondering if entity framework has some features that I would be able to take advantage of them and let my user to declare an entity type. 

    Tuesday, June 11, 2019 9:57 AM

All replies

  • so I was wondering if entity framework has some features that I would be able to take advantage of them and let my user to declare an entity type. 

    No,  you can't do it. EF, an ORM,  uses the virtual object model, which is a collection of concrete types/classes/objects  that represent tables in a relational database in the form of objects that can be used programmically. You can't dynamically make objects up and use them with EF or any ORM.

    • Proposed as answer by Dark and Sad Tuesday, June 11, 2019 7:54 PM
    • Unproposed as answer by Dark and Sad Tuesday, June 11, 2019 7:59 PM
    • Proposed as answer by Dark and Sad Tuesday, June 11, 2019 7:59 PM
    Tuesday, June 11, 2019 1:04 PM