ASP.NET Identity with Repository and Unit of Work

前端 未结 4 642

I\'m learning Repository and Unit of Work patterns in ASP.NET MVC 5 application with Entity Framework 6.

I had already read a lot of tutorials and articles, but almo

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 18:06

    "One issue to be aware of is that the UserStore class does not play well when using the unit of work design pattern. Specifically, the UserStore invokes SaveChanges in nearly every method call by default, which makes it easy to prematurely commit a unit of work. To change this behavior, change the AutoSaveChanges flag on the UserStore."

    var store = new UserStore(new ApplicationDbContext());
    store.AutoSaveChanges = false;
    

    From Scott Allen: http://odetocode.com/blogs/scott/archive/2014/01/03/asp-net-identity-with-the-entity-framework.aspx

提交回复
热议问题