dimanche 25 février 2018

Implementing UnitOfWork with Service and Repository layers in a MVC 5 application with Entity Framework

Could you please help me with some guidance in implementing the Unit of work pattern with the service and repository layer. The application is using the EF ORM.

Currently, I have the service and repository layers implemented, however, I need to adapt the application architecture and implement the Unit of Work layer in order to support atomic operations from multiple service classes.

I don't know how exactly the Unit of Work layer should be implemented, who will have the responsibility of instantiating it and who should commit the changes ?

In my mind, I'm thinking of instantiating an unit of work in the controller and control all the actions through its reference. The unit of work object will contain all references (interfaces) to all of the service classes. Would this be a good approach ?

Regards

Aucun commentaire:

Enregistrer un commentaire