ASP.NET 5 MVC 6 Generic Repository Pattern

前端 未结 3 2111
清酒与你
清酒与你 2021-02-10 14:34

Been looking every where for a tutorial or something.

I\'ve been trying to implement my old generic repository pattern for MVC5 into a new MVC6 project.

I set up

3条回答
  •  时光取名叫无心
    2021-02-10 14:42

    In Entity Framework 7 IDbSet itself represents an implementation of Repository pattern.

    /// 
    ///     A DbContext instance represents a session with the database and can be used to query and save
    ///     instances of your entities. DbContext is a combination of the Unit Of Work and Repository patterns.
    /// 
    

    Source: GitHub EntityFramework7 repo, DbContext.cs 24-27 line

    And DBContext it's implementation of UnitOfWork

提交回复
热议问题