public AlterMarriedStatusIntoSingleTS() : base( DataSynchronizationManager.GetInstance(), DataSynchronizationManager.GetInstance() ) { }
public void Initialize() { _manager = DataSynchronizationManager.GetInstance(); _manager.RegisterEntity( new CustomerMapper(), new List <IBaseQueryObject <Customer> > { { new GetCustomerByIdQuery() }, { new GetCustomerByCivilStatusQuery() } }); }
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 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 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 Initialize() { _dataSyncManager = DataSynchronizationManager.GetInstance(); _fkMappingManager = ForeignKeyMappingManager.GetInstance(); _dataSyncManager.RegisterEntity( new CustomerMapper(), new List <IBaseQueryObject <Customer> > { { new GetCustomerByIdQuery() }, { new GetCustomerByCivilStatusQuery() } }); _dataSyncManager.RegisterEntity( new AccountReceivableMapper(), new List <IBaseQueryObject <AccountReceivable> > { { new GetAccountReceivablesByCustomerId() } }); _fkMappingManager.RegisterForeignKeyMapping(new FK_Customer_AccountReceivable()); }
IDictionary <string, Tuple <PropertyInfo, object> > GetPrimitiveProperties <TEntity>(TEntity entity) where TEntity : IDomainObject { IList <PropertyInfo> properties = DataSynchronizationManager .GetInstance() .GetProperties <TEntity>() .Values .ToList(); IDictionary <string, Tuple <PropertyInfo, object> > propertyValues = new Dictionary <string, Tuple <PropertyInfo, object> >(); for (int index = 0; index < properties.Count; index++) { PropertyInfo property = properties[index]; object value = property.GetValue(entity); propertyValues.Add(property.Name, new Tuple <PropertyInfo, object>(property, value)); } return(propertyValues); }
public TEntity CreateLazyLoadEntity <TEntity, TSearchInput>(TSearchInput criteria) where TEntity : IDomainObject { string fullName = GetFullname <TEntity, TSearchInput>(); if (!_typeDictionary.ContainsKey(fullName)) { throw new TypeLoadException(string.Format("Lazy load for type '{0}' is not registered", fullName)); } Type lazyLoadType = _typeDictionary[fullName]; TEntity entity = (TEntity)Activator.CreateInstance( lazyLoadType, new object[] { DataSynchronizationManager.GetInstance().GetRepository <TEntity>(), criteria }); return(entity); }
public FK_Customer_AccountReceivable() { _manager = DataSynchronizationManager.GetInstance(); }