开发者

Entity Framework Generic CRUD

I'm about to start a small project using .NET 4, C#, and Entity Framework v4.

I have 50 tables plus. If I write a separate CRUD for each entity (each table) will be a lot of work and I'm practicing DRY. So, I'm thinking of generic CRUD for Entity Framework. But there are pros and cons about generic CRUD.

After searching for a generic CRUD for Entity Framework, I found one at h开发者_如何转开发ttps://github.com/rcravens/GenericRepository and it has some pros and cons.

Cons:

    Hides useful features of the ORM
    Adds complexity to the design

Pros:

    Abstracts away the ORM / persistence implementation
    Allows the persistence layer to be faked for testing

So, if you used a generic CRUD of Entity Framework, you had any major problems? Also, are there any generic CRUD for Entity Framework beside GenericRepository?


I guess it's not 100% to your question because I don't use any generic "CUD" out there but I normaly use the Repository-Pattern. It's rather easy to write a simple abstract-base class that handles most of the EF specifics and you only have to write some case-specific implementations.

see SO question for more details on the pattern.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜