Exemplo n.º 1
0
 public override GetCatResp Process(GetCatReq req)
 {
     using (var unitOfWork = _unitOfWorkFactory.CreateAndBeginTransactionForHelloWorld(false))
     {
         return(new GetCatResp {
             Cat = _mapperFactory.CreateCatMapper(unitOfWork).Map(_repositoryFactory.CreateCatRepository(unitOfWork).LoadAll()[0])
         });
     }
 }
Exemplo n.º 2
0
        public override AddAnimalsResp Process(AddAnimalsReq req)
        {
            // A handler should map to Response object (AddAnimalsResp)
            // If needed here we can open a unit of work (Optional) or dbContext transaction.
            using (var unitOfWork = _unitOfWorkFactory.CreateAndBeginTransactionForHelloWorld(false))
            {
                // Get the logic class given the unitOfWork or DbContext created/opened here.
                var animalLogic = _logicFactory.CreateAnimalLogic(unitOfWork);
                animalLogic.AddAnimals(req.CatColor, req.DogColor);

                unitOfWork.Commit();
                return(new AddAnimalsResp());
            }
        }