ASP.NET Identity with Repository and Unit of Work

前端 未结 4 651

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:13

    If you are using Repository and UnitofWork pattern may be you are using it with DDD (Domain Driven Design) where you declare IRepository or IUnitofWork in Core project along with all other domain model and abstract classes.

    Now you make Infrastructure project which implements those interfaces in Core project using concrete data access object for this instance Entity Framework. so DbContext is fine there but yes don't expose it to presentation layer. So at some point if you want to change EF to any other ORM then it will be easier without touching presentation layer where you put your Identity classes separate from Data Access or Infrastructure project. And of course you can use IOC container to instantiate those concrete Repositories from Infrastructure in Controllers of Presentation layer.

提交回复
热议问题