jeudi 28 avril 2016

Transaction Script and Unit of Work

We have a C# solution in which we applied the Transaction Script pattern; its layers are the following:

  • Adapter: access point to the aplication (consumed by MVC Controllers and API Controllers); allways calls exactly one method from Logic layer;
  • Logic: methods with business logic; inside each method we could have several calls to other logic/repository methods;
  • Data Access: methods with calls to NHibernate and/or NPGSQL (for expensive operations requiring stored procedures)

Now, we want to implement the Unit of Work pattern using TransactionScope to use one and only one transaction per request (i.e.: one transaction per call to methods from Adapter, since we use UoW at Adapter level), but we can't figure out how to manage the connections, since we could have connections for NHibernate and/or NPGSQL inside the same method.

Regards

Aucun commentaire:

Enregistrer un commentaire