public void testInit() { mockLogger = new Mock <ILogger>(); mockLogger.Setup(x => x.Log(It.IsAny <string>())); _stringToFootballTeamMapper = new StringToFootballTeamMapper(mockLogger.Object); }
public LazyLoadDomainObject( TSearchInput criteria, IBaseMapper mapper ) : base(mapper) { _criteria = criteria; }
void ApplyOperation( UnitOfWorkAction action, IList <IDomainObject> affectedEntities, SuccessfulUoWInvocationDelegate successfulInvocation, FailedUoWInvocationDelegate failedInvocation ) { for (int index = 0; index < affectedEntities.Count; index++) { IDomainObject entity = affectedEntities[index]; if (entity == null) { continue; } IBaseMapper mapper = entity.Mapper; OperationDelegate operation = GetOperation(action, mapper); bool success = operation(ref entity, (domainObject, results) => { if (successfulInvocation != null) { successfulInvocation(domainObject, action, results); } }, (domainObject, results) => { if (failedInvocation != null) { failedInvocation(domainObject, action, results); } }); } }
public TagEventTasks( IBaseMapper baseMapper, ITagEventTypeTasks tagEventTypeTasks ) { this.baseMapper = Requires.IsNotNull(baseMapper, nameof(baseMapper)); this.tagEventTypeTasks = Requires.IsNotNull(tagEventTypeTasks, nameof(tagEventTypeTasks)); }
public TagRegistrationController( ITagRegistrationTasks tagRegistrationTasks, IBaseMapper baseMapper ) { this.tagRegistrationTasks = Requires.IsNotNull(tagRegistrationTasks, nameof(tagRegistrationTasks)); this.baseMapper = Requires.IsNotNull(baseMapper, nameof(baseMapper)); }
public PatientTasks( ITagTasks tagTasks, IBaseMapper baseMapper ) { this.tagTasks = Requires.IsNotNull(tagTasks, nameof(tagTasks)); this.baseMapper = Requires.IsNotNull(baseMapper, nameof(baseMapper)); }
public ProductDomain(IBaseMapper mapper, Criteria criteria) : base(criteria, mapper) { if (criteria != null) { Id = criteria.Id; } }
/// <summary> /// Initializes a new instance of the <see cref="TagEventController"/> class. /// </summary> public TagEventController( ITagEventTask tagEventTasks, IBaseMapper baseMapper ) { this.tagEventTasks = Requires.IsNotNull(tagEventTasks, nameof(tagEventTasks)); this.baseMapper = Requires.IsNotNull(baseMapper, nameof(baseMapper)); }
public ProjectService(ILogger <ProjectService> logger, IBaseMapper <Project, ProjectDto> projectMapper, IModelMapper <Project, ProjectDetailsDto> projectDetailsMapper, IProjectRepository projectRepository) { _logger = logger; _projectMapper = projectMapper; _projectDetailsMapper = projectDetailsMapper; _projectRepository = projectRepository; }
public TeamService(ILogger <TeamService> logger, IBaseMapper <Team, TeamDto> teamMapper, IModelMapper <Team, TeamDetailsDto> teamDetailsMapper, ITeamRepository teamRepository, IProjectRepository projectRepository) { _logger = logger; _teamMapper = teamMapper; _teamDetailsMapper = teamDetailsMapper; _teamRepository = teamRepository; _projectRepository = projectRepository; }
public UserService(ILogger <UserService> logger, ITeamRepository teamRepository, IUserRepository userRepository, IBaseMapper <TimeTrackingUser, TimeTrackingUserDto> userMapper, IModelMapper <TimeTrackingUser, TimeTrackingUserDetailsDto> userDetailsMapper) { _logger = logger; _teamRepository = teamRepository; _userRepository = userRepository; _userMapper = userMapper; _userDetailsMapper = userDetailsMapper; }
public void TestCommit_SimpleInsertion() { IRepository <Customer> repository = _manager.GetRepository <Customer>(); GetCustomerByCivilStatusQuery.Criteria criteriaByStatus = GetCustomerByCivilStatusQuery.Criteria.SearchByStatus(GetCustomerByCivilStatusQuery.CivilStatus.Married); GetCustomerByIdQuery.Criteria criteriaById = GetCustomerByIdQuery.Criteria.SearchById(2); List <Customer> customerResults = new List <Customer>(); IUnitOfWork uow = new UnitOfWork(); customerResults.AddRange(repository.Matching(criteriaByStatus)); customerResults.AddRange(repository.Matching(criteriaById)); IBaseMapper mapper = DataSynchronizationManager.GetInstance().GetMapper <Customer>(); Customer customer1 = new Customer(mapper) { Number = "1" }; Customer customer2 = new Customer(mapper) { Number = "2" }; Customer customer3 = new Customer(mapper) { Number = "3" }; //Sequence of observation affects commit order uow.RegisterNew(customer1); uow.RegisterNew(customer3); uow.RegisterNew(customer2); IList <string> sequenceDescription = new List <string>(); uow.Commit( (domainObject, action, results) => { string description = ((results != null) && (results[CustomerMapper.SUCCESS_DESCRIPTION] != null)) ? (string)results[CustomerMapper.SUCCESS_DESCRIPTION] : string.Empty; sequenceDescription.Add(string.Format("{0}={1}={2}", description, action.ToString(), domainObject.Mapper.GetEntityTypeName())); }, (domainObject, action, results) => { } ); Assert.AreEqual("1=Insert=Customer", sequenceDescription[0]); Assert.AreEqual("3=Insert=Customer", sequenceDescription[1]); Assert.AreEqual("2=Insert=Customer", sequenceDescription[2]); }
public MileStoneService(ILogger <Milestone> logger, IBaseMapper <Milestone, MilestoneDto> milestoneMapper, IModelMapper <Milestone, MilestoneDetailsDto> milestoneDetailsMapper, IMilestoneRepository milestoneRepository, IUserProvider userProvider, IProjectRepository projectRepository) { _logger = logger; _milestoneMapper = milestoneMapper; _milestoneDetailsMapper = milestoneDetailsMapper; _milestoneRepository = milestoneRepository; _userProvider = userProvider; _projectRepository = projectRepository; }
void ApplyDomainObjectSettings(ref IList <TEntity> newResult, IBaseQueryObject query) { if ((newResult == null) || (!newResult.Any())) { return; } IBaseMapper <TEntity> mapper = DataSynchronizationManager.GetInstance().GetMapper <TEntity>(); ((List <TEntity>)newResult).ForEach(entity => { ((ISystemManipulation)entity).SetQueryObject(query); ((ISystemManipulation)entity).SetMapper(mapper); }); }
public UserIdentityService(UserManager <User> userManager, IUserRepository userRepository, ISystemClock systemClock, IEmailHelperService emailHelperService, IBaseMapper <User, UserDto> userMapper, ILogger <UserIdentityService> logger, IPublishEndpoint publish) { _userManager = userManager; _userRepository = userRepository; _systemClock = systemClock; _emailHelperService = emailHelperService; _userMapper = userMapper; _logger = logger; _publish = publish; }
public override IList <Customer> PerformSearchOperation(Criteria searchInput) { Dictionary <int, string> customerList = new Dictionary <int, string>(); customerList.Add(1, "Juan dela Cruz"); customerList.Add(2, "Jane Doe"); customerList.Add(3, "John Doe"); Tuple <string, string> searchResult = new Tuple <string, string>(searchInput.CustomerId.ToString(), customerList[searchInput.CustomerId]); IBaseMapper mapper = DataSynchronizationManager.GetInstance().GetMapper <Customer>(); Customer customer = new Customer(mapper); customer.Number = searchResult.Item1; customer.Name = searchResult.Item2; return(new List <Customer>(new[] { customer })); }
public IssueService(ILogger <IssueService> logger, IIssueRepository issueRepository, IUserService userService, IMileStoneService mileStoneService, IProjectService projectService, ISystemClock systemClock, IBaseMapper <Issue, IssueDto> issueMapper, IModelMapper <Issue, IssueDetailsDto> issueDetailsMapper) { _logger = logger; _issueRepository = issueRepository; _userService = userService; _mileStoneService = mileStoneService; _projectService = projectService; _systemClock = systemClock; _issueMapper = issueMapper; _issueDetailsMapper = issueDetailsMapper; }
public override IList <Customer> PerformSearchOperation(Criteria searchInput) { Dictionary <CivilStatus, Tuple <string, string> > customerList = new Dictionary <CivilStatus, Tuple <string, string> >(); customerList.Add(CivilStatus.Single, new Tuple <string, string>("4", "Test Single")); customerList.Add(CivilStatus.Married, new Tuple <string, string>("5", "Test Married")); customerList.Add(CivilStatus.Divorced, new Tuple <string, string>("6", "Test Divorced")); Tuple <string, string> searchResult = customerList[searchInput.CurrentCivilStatus]; IBaseMapper mapper = DataSynchronizationManager.GetInstance().GetMapper <Customer>(); Customer customer = new Customer(mapper); customer.Number = searchResult.Item1; customer.Name = searchResult.Item2; return(new List <Customer>(new[] { customer })); }
public void TestLazyLoadProducts() { LazyLoader <ProductDomain, ProductDomain.Criteria> loader = new ProductLazyLoader(); IList <ProductDomain> list = new LazyLoadList <ProductDomain, ProductDomain.Criteria>(loader); IBaseMapper mapper = null; list.Add(new ProductDomain(mapper, ProductDomain.Criteria.SearchById(2))); list.Add(new ProductDomain(mapper, ProductDomain.Criteria.SearchById(4))); list.Add(new ProductDomain(mapper, ProductDomain.Criteria.SearchById(5))); ProductDomain product = list.FirstOrDefault(x => x.Id == 2); Assert.IsTrue(string.IsNullOrEmpty(product.Description)); //Description is not loaded Assert.AreEqual("Product two", list[0].Description); Assert.AreEqual("Product four", list[1].Description); Assert.AreEqual("Product five", list[2].Description); Assert.IsFalse(string.IsNullOrEmpty(product.Description)); //Description is now loaded }
public WorkLogService(ILogger <WorkLogService> logger, IBaseMapper <WorkLog, WorkLogDto> worklogMapper, IUserProvider userProvider, IUserService userService, IWorklogRepository worklogRepository, IIssueService issueService, IEmailHelper emailHelper, IModelMapper <WorkLog, WorkLogDetailsDto> worklogDetailsMapper) { _logger = logger; _worklogMapper = worklogMapper; _userProvider = userProvider; _worklogRepository = worklogRepository; _issueService = issueService; _emailHelper = emailHelper; _userService = userService; _worklogDetailsMapper = worklogDetailsMapper; }
public DomainTier(TargetImplement targetImplement = TargetImplement.V1) { switch (targetImplement) { case TargetImplement.V1: { AccountMapper = Domain.DependencyResolution.IoC.Container().GetInstance <IBaseMapper <AccountModel, Account> >(TargetImplement.V1.ToString()); SystemExceptionLogMapper = Domain.DependencyResolution.IoC.Container().GetInstance <IBaseMapper <SystemExceptionLogModel, SystemExceptionLog> >(TargetImplement.V1.ToString()); break; } case TargetImplement.V2: { break; } default: break; } }
OperationDelegate GetOperation(UnitOfWorkAction action, IBaseMapper mapper) { OperationDelegate operation = null; switch (action) { case UnitOfWorkAction.Insert: operation = new OperationDelegate(mapper.Insert); break; case UnitOfWorkAction.Update: operation = new OperationDelegate(mapper.Update); break; case UnitOfWorkAction.Delete: operation = new OperationDelegate(mapper.Delete); break; } return(operation); }
public void RegisterEntity <TEntity>(IBaseMapper <TEntity> mapper, IList <IBaseQueryObject <TEntity> > queryList) where TEntity : IDomainObject { IEntityServiceContainer <TEntity> serviceContainer = new EntityServiceContainer <TEntity> { Mapper = mapper, IdentityMap = new IdentityMap <TEntity>(), Repository = new Repository <TEntity>(this), QueryDictionary = ConvertQueryListToDictionary(queryList), PrimitiveProperties = GetPrimitiveProperties <TEntity>() }; string key = GetServiceContainerKey <TEntity>(); if (ServiceContainerExists(key)) { _serviceContainerDictionary.Remove(key); } _serviceContainerDictionary.Add(key, serviceContainer); }
public EFBaseRepository(TDbContext repoDbContext, IBaseMapper <TDomainEntity, TDALEntity> mapper) : base( repoDbContext, mapper) { }
public void SetMapper(IBaseMapper <T> mapper) { _mapper = mapper; }
public DomainObject(IBaseMapper mapper) { _mapper = mapper; _systemId = Guid.NewGuid(); }
public Customer(IBaseMapper mapper) : base(mapper) { }
public TagTasks( IBaseMapper baseMapper) { this.baseMapper = Requires.IsNotNull(baseMapper, nameof(baseMapper)); }
public AccountReceivable(IBaseMapper mapper) : base(mapper) { }