Entity Framework 4.1 - Override Entity (DBSet) with Filter

后端 未结 5 1685
余生分开走
余生分开走 2021-02-06 03:38

I\'m trying to do something which should be relatively easy, but i just dont know how to construct it.

I have a Generated Entity which I\'d like to override by adding a

5条回答
  •  执念已碎
    2021-02-06 04:17

    A good practice is to create repository classes in a DAL folder(use the name you want). Then do the filters there. Here is a microsoft tutorial for that:

    http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application

    Depending of the condition you want is not possible to put on EF mapping condition, here is the reason: http://entityframework.codeplex.com/workitem/48

提交回复
热议问题