コード例 #1
0
        public virtual U BuildRequest <R, U>(R request, IConfigurationProvider mapperConfiguration) where R : class, new() where U : class, new()
        {
            U upsRequest = new U();

            try
            {
                var executionPlan = mapperConfiguration.BuildExecutionPlan(typeof(R), typeof(U));
                mapperConfiguration.AssertConfigurationIsValid();
                //Mapper mapper = new Mapper(ProcessShipmentConfiguration);
                var iMapper = mapperConfiguration.CreateMapper();
                upsRequest = iMapper.Map <U>(request);
            }
            catch (Exception ex) { }
            return(upsRequest);
        }
コード例 #2
0
        public virtual A BuildResponse <R, A>(R response, IConfigurationProvider mapperConfiguration) where R : class, new() where A : class, new()
        {
            A answer = new A();

            try
            {
                var executionPlan = mapperConfiguration.BuildExecutionPlan(typeof(R), typeof(A));
                mapperConfiguration.AssertConfigurationIsValid();
                //Mapper mapper = new Mapper(ProcessShipmentConfiguration);
                var iMapper = mapperConfiguration.CreateMapper();
                answer = iMapper.Map <A>(response);
            }
            catch (Exception ex) { }
            return(answer);
        }
コード例 #3
0
 public void CreateMappings(IConfigurationProvider configuration)
 {
     configuration.BuildExecutionPlan(typeof(Data.Account), typeof(Create));
     configuration.CreateMapper();
 }