Last post Dec 31, 2012 10:51 AM by biggreycat
Dec 24, 2012 01:48 PM|bcompt143|LINK
I use UnitOfWork and Repository pattern for my Enterprise application. Due to I'm new to this patter I get confused what should I do to use Bussines Service Calss. In many example, they use UnitOfWork injection directly to MVC controller. But I wana to extract
every bussines logics to other class called bussines service. What should I do? plz with example!
Dec 31, 2012 10:51 AM|biggreycat|LINK
I am not sure if I understand you correctly. We seldom put unitOfWork in controllers. As you said, the logic inside a method of a business service class should be inside a single transaction. For example.
using(UnitOfWork uw = new UnitOfWork())
decimal oldBalance = new AccountRep(uw).Retrieve(id);
new InterestRep(uw).Increase(Id, oldBalance * 0.04);