private void Initialize(EmployeeInputDto employee, EntityDependency[] dependencies) { RegisterCommandRepositoryFactory <Employee>(() => new EmployeeCommandRepository()); var managerDependency = (Manager)dependencies?.SingleOrDefault()?.Entity; RootEntity = new Employee { Id = employee.EmployeeId, Name = employee.Name, SupervisorId = (managerDependency != null) ? managerDependency.Id : employee.SupervisorId }; Enqueue(new SaveEntityCommandOperation <Employee>(RootEntity, dependencies)); }
public SaveEmployeeCommandAggregate(EmployeeInputDto employee, EntityDependency[] dependencies = null) : base(new DomainFramework.DataAccess.RepositoryContext(ManagerWithEmployeesConnectionClass.GetConnectionName())) { Initialize(employee, dependencies); }