Esempio n. 1
0
 public void Show()
 {
     //Somewhere in an application service wrapper
       var unitOfWork = new UnitOfWork();
       //Dependency of a domain service or application service
       var dogRepository = new Repository<Dog>(id => null, unitOfWork);
       //Application service handler code
       var dog = new Dog(Guid.NewGuid(), "Sparky", DateTime.Today.AddYears(-1));
       dog.AdministerShotOf("Anti Diarrhea Medicine", DateTime.Today);
       dogRepository.Add(dog.DogId, dog);
       //Back in the application service wrapper
       Console.WriteLine("We observed that:");
       foreach(var change in unitOfWork.GetChanges().SelectMany(aggregate => aggregate.Root.GetChanges())) {
     Console.WriteLine(change);
       }
 }
Esempio n. 2
0
        public void Show()
        {
            //Somewhere in an application service wrapper
            var unitOfWork = new UnitOfWork();
            //Dependency of a domain service or application service
            var dogRepository = new Repository <Dog>(Dog.Factory, unitOfWork, new EmptyEventStreamReader());
            //Application service handler code
            var dog = new Dog(Guid.NewGuid(), "Sparky", DateTime.Today.AddYears(-1));

            dog.AdministerShotOf("Anti Diarrhea Medicine", DateTime.Today);
            dogRepository.Add(dog.DogId.ToString(), dog);
            //Back in the application service wrapper
            Console.WriteLine("We observed that:");
            foreach (var change in unitOfWork.GetChanges().SelectMany(aggregate => aggregate.Root.GetChanges()))
            {
                Console.WriteLine(change);
            }
        }