コード例 #1
0
        public void TestUow()
        {
            Employees employ = new Employees
            {
                company    = "Alibaba",
                first_name = "Jack",
                last_name  = "Ma",
                city       = "Hangzhou"
            };


            IEmployeeRepository employeeRepository = new EmployeeRepository(_uowcontext);

            //UoW
            employ.AddDomainEvent(new TestEvent("addEvent"));
            var id = employeeRepository.Add(employ);

            var employee = employeeRepository.GetAsync(id).Result;

            employee.job_title = "CEO";

            employee.AddDomainEvent(new TestEvent("changeEvent"));
            employeeRepository.Update(employee);

            employeeRepository.UnitOfWork.SaveEntitiesAsync();
        }