public PumpCategoryController(IService <PumpCategory> pumpCategoryService, IMappingServiceProvider mapper, ILogger logger) : base(logger) { _pumpCategoryService = pumpCategoryService; _mapper = mapper; }
public void Configure(IMappingServiceProvider mappingServiceProvider) { mappingServiceProvider.RegisterByKey <string, List <Transaction> >("application/vnd.ms-excel", new Func <string, List <Transaction> >((input) => { var result = new List <Transaction>(); var stringReader = new StringReader(input); var transactionLine = ""; while ((transactionLine = stringReader.ReadLine()) != null) { var splitted = transactionLine.Matches("(?<=\")(.*?)(?=\")").Where(value => value != ",").ToArray(); var transaction = new Transaction { TransactionId = splitted[0], Amount = decimal.Parse(splitted[1]), CurrencyCode = (ISO4217CurrencyCode.Values)Enum.Parse(typeof(ISO4217CurrencyCode.Values), splitted[2]), TransactionDate = DateTime.ParseExact(splitted[3], "dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture), Status = (TransactionStatus.Values)Enum.Parse(typeof(TransactionStatus.Values), splitted[4].ToUpper()), }; result.Add(transaction); } return(result); })); }
private RemoteApiRequest(IRemoteApiInfo api, IRemoteApiRepository apiRepository, IRemoteApiMethodInfo methodInfo, IMappingServiceProvider mapping) { _api = api; _apiRepository = apiRepository; _methodInfo = methodInfo; _mapping = mapping; }
public OutputController(OutputService outputService, IMappingServiceProvider mapper, ILogger logger) : base(logger) { _outputService = outputService; _mapper = mapper; }
public Mapper() { if (_mapper == null) { _mapper = ExpressMapper.Mapper.Instance; RegisterMaps(); } }
public ProductSubCategoryController(IService <ProductSubCategory> productSubCategoryService, IService <ProductCategory> productCategoryService, IMappingServiceProvider mapper, ILogger logger) : base(logger) { _productSubCategoryService = productSubCategoryService; _productCategoryService = productCategoryService; _mapper = mapper; }
protected override void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider) { MethodInfo mapMethod = typeof(IMappingServiceProvider).GetInfo().GetMethods() .First(mi => mi.Name == "Map" && mi.GetParameters().Length == 1) .MakeGenericMethod(typeof(T), typeof(TN)); MethodCallExpression methodCall = Expression.Call(Expression.Constant(serviceProvider), mapMethod, this.SourceParameter); this.RecursiveExpressionResult.Add(Expression.Assign(this.DestFakeParameter, methodCall)); }
protected TypeMapperBase(IMappingService service, IMappingServiceProvider serviceProvider) { ResultExpressionList = new List <Expression>(); RecursiveExpressionResult = new List <Expression>(); PropertyCache = new Dictionary <string, Expression>(); CustomPropertyCache = new Dictionary <string, Expression>(); IgnoreMemberList = new List <string>(); MappingService = service; InitializeRecursiveMappings(serviceProvider); }
public AdminController(IService <Product> productService, IService <Pump> pumpService, IService <Output> outputService, IMappingServiceProvider mapper, ILogger logger) : base(logger) { _productService = productService; this.pumpService = pumpService; _outputService = outputService; _mapper = mapper; }
protected override void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider) { var mapMethod = typeof(IMappingServiceProvider).GetMethods() .First(mi => mi.Name == MapStr && mi.GetParameters().Length == 2) .MakeGenericMethod(typeof(T), typeof(TN)); var methodCall = Expression.Call(Expression.Constant(serviceProvider), mapMethod, SourceParameter, DestFakeParameter); RecursiveExpressionResult.Add(Expression.Assign(DestFakeParameter, methodCall)); }
public HomeController(IService <ProductCategory> productCategoryService, IService <PumpCategory> pumpCategoryService, IEmailSender emailSender, ILogger logger, IMappingServiceProvider mapper) : base(logger) { _productCategoryService = productCategoryService; _pumpCategoryService = pumpCategoryService; _emailSender = emailSender; _logger = logger; _mapper = mapper; }
public void Configure(IMappingServiceProvider mappingServiceProvider) { mappingServiceProvider.RegisterByKey("text/xml", new Func <string, List <Transaction> >((input) => { var result = new List <Transaction>(); var xmlDeserializer = new XmlSerializer(typeof(List <Transaction>)); var buffer = Encoding.UTF8.GetBytes(input); var memoryStream = new MemoryStream(buffer); result = (List <Transaction>)xmlDeserializer.Deserialize(memoryStream); return(result); })); }
protected TypeMapperBase(IMappingService service, IMappingServiceProvider serviceProvider) { this.ResultExpressionList = new List <Expression>(); this.RecursiveExpressionResult = new List <Expression>(); this.PropertyCache = new Dictionary <string, Expression>(); this.CustomPropertyCache = new Dictionary <string, Expression>(); this.IgnoreMemberList = new List <string>(); this.MappingService = service; this.MappingServiceProvider = serviceProvider; this.InitializeRecursiveMappings(serviceProvider); this.CustomMembers = new List <KeyValuePair <MemberExpression, Expression> >(); this.FlattenMembers = new List <KeyValuePair <MemberExpression, Expression> >(); this.CustomFunctionMembers = new List <KeyValuePair <MemberExpression, Expression> >(); }
public void Configure(IMappingServiceProvider mappingServiceProvider) { mappingServiceProvider.Register(new Func <List <Transaction>, List <GetAllTransactionsResponseModel> >((input) => { var result = input.Select(transaction => new GetAllTransactionsResponseModel { Id = transaction.TransactionId, Payment = $"{transaction.Amount} {transaction.CurrencyCode}", Status = transaction.Status == TransactionStatus.Values.APPROVED ? "A" : transaction.Status == TransactionStatus.Values.FAILED || transaction.Status == TransactionStatus.Values.REJECTED ? "R" //FINISHED,DONE : "D" }).ToList(); return(result); })); }
public void Configure(IMappingServiceProvider mappingServiceProvider) { mappingServiceProvider.RegisterByKey <string, List <Transaction> >("text/xml", new Func <string, List <Transaction> >((input) => { var result = new List <Transaction>(); var transactions = XElement.Parse(input); transactions.Descendants("Transaction").ToList().ForEach(element => { var transaction = new Transaction { TransactionId = element.Attribute("id").Value, TransactionDate = DateTime.Parse(element.Element("TransactionDate").Value), Status = (TransactionStatus.Values)Enum.Parse(typeof(TransactionStatus.Values), element.Element("Status").Value.ToUpper()), Amount = decimal.Parse(element.Element("PaymentDetails").Element("Amount").Value), CurrencyCode = (ISO4217CurrencyCode.Values)Enum.Parse(typeof(ISO4217CurrencyCode.Values), element.Element("PaymentDetails").Element("CurrencyCode").Value) }; result.Add(transaction); }); return(result); })); }
internal MappingServiceBase(IMappingServiceProvider mappingServiceProvider) { MappingServiceProvider = mappingServiceProvider; TypeMappers = new Dictionary <int, ITypeMapper>(); }
protected abstract void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider);
public TransactionManager(DataContext dataContext, IValidationServiceProvider validationService, IMappingServiceProvider mappingServiceProvider) { _validationService = validationService; _mappingServiceProvider = mappingServiceProvider; _dataContext = dataContext; }
public MemberConfiguration(ITypeMapper <T, TN>[] typeMappers, IMappingServiceProvider mappingServiceProvider) { this._typeMappers = typeMappers; this._mappingServiceProvider = mappingServiceProvider; }
internal MappingServiceBase(IMappingServiceProvider mappingServiceProvider) { this.MappingServiceProvider = mappingServiceProvider; this.TypeMappers = new Dictionary <long, ITypeMapper>(); }
public DestinationMappingService(IMappingServiceProvider mappingServiceProvider) : base(mappingServiceProvider) { }
public EntityFrameworkMapper(IMappingServiceProvider mapper) { _mapper = mapper; }
public SourceMappingService(IMappingServiceProvider mappingServiceProvider) : base(mappingServiceProvider) { }
public DestinationTypeMapper(IMappingService service, IMappingServiceProvider serviceProvider) : base(service, serviceProvider) { }
public ProductSubCategoryService(IUnitOfWork unitOfWork, IMappingServiceProvider mapper) { _unitOfWork = unitOfWork; _mapper = mapper; }
public PumpService(IUnitOfWork unitOfWork, IMappingServiceProvider mapper) { _unitOfWork = unitOfWork; _mapper = mapper; }
public SourceTypeMapper(IMappingService service, IMappingServiceProvider serviceProvider) : base(service, serviceProvider) { }