none
Can EF 6 get DbSet from table/view without definition of a class? RRS feed

  • Question

  • Table/View should have all column infos, I don't get why I have to define a class if I just want to return all columns, seems it is pretty trouble you have to modify the class everytime you add/remove a column from the table/view?

    Any idea?

    Thanks


    WYX

    Thursday, March 20, 2014 7:28 PM

Answers

  • Hello,

    >>Can EF 6 get DbSet from table/view without definition of a class?

    Unlucky, we cannot get DbSet from table/view without definition of a class.

    With these classes, we use custom data classes together with the data model without making any modifications to the data classes themselves, these classes support most of the same query, insert, update, and delete behaviors as entity types that are generated by the Entity Data Model tools and support lazy loading of the related objects.

    Without these classes, we cannot use these features above and of course there are more in actually.

    Everything has its opposite side, for these entity classes, they are same and it is what you said “it is pretty trouble you have to modify the class everytime you add/remove a column from the table/view”, it actually will cost much time if the database is Bulky.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, March 21, 2014 7:13 AM
    Moderator