Exemplo n.º 1
0
        // Submit with Configuaration Package Name
        public IAutoMapperRequestKey <TSource, TDestination> SubmitRawAutoMapperRequest <TSource, TDestination>
        (
            IMapTypeDefinition srcMapTypeDef,
            IMapTypeDefinition dstMapTypeDef,
            IAutoMapperConfigDetails configuationDetails,
            string configPackageName,
            IHaveAMapperConfigurationStep configStarterForThisRequest
        )
        {
            if (_mapperConfigurationLookupService == null)
            {
                throw new InvalidOperationException("The AutoMapperService has no MapperConfigurationLookup Service.");
            }

            // Lookup the package name and return a mapping configuration.
            IConfigureAMapper <TSource, TDestination> mappingConfiguration
                = _mapperConfigurationLookupService.GetTheMapperConfig <TSource, TDestination>(configPackageName);

            IAutoMapperRequestKey <TSource, TDestination> result
                = SubmitRawAutoMapperRequest
                  (
                      srcMapTypeDef,
                      dstMapTypeDef,
                      configuationDetails,
                      mappingConfiguration,
                      configStarterForThisRequest
                  );

            return(result);
        }
Exemplo n.º 2
0
        // Typed Submit Raw Auto
        public IAutoMapperRequestKey <TSource, TDestination> SubmitRawAutoMapperRequest <TSource, TDestination>
        (
            IMapTypeDefinition srcMapTypeDef,
            IMapTypeDefinition dstMapTypeDef,
            IAutoMapperConfigDetails configuationDetails,
            IConfigureAMapper <TSource, TDestination> mappingConfiguration,
            IHaveAMapperConfigurationStep configStarterForThisRequest
        )
        {
            // Create a MapperBuilder for this request.
            IAutoMapperBuilder <TSource, TDestination> autoMapperBuilder
                = BuildTheAutoMapperBuilder <TSource, TDestination>(configStarterForThisRequest);

            // Create the mapper request.
            IAutoMapperRequestKey <TSource, TDestination> autoMapperRequestKey
                = new AutoMapperRequestKey <TSource, TDestination>
                  (
                      sourceMapTypeDef: srcMapTypeDef,
                      destinationMapTypeDef: dstMapTypeDef,
                      autoMapperConfigDetails: configuationDetails,
                      mappingConfiguration: mappingConfiguration,
                      autoMapperBuilder: autoMapperBuilder);

            IAutoMapperRequestKeyGen response_AutoMapperRequestKey
                = RegisterAutoMapperRequest(autoMapperRequestKey);

            return((IAutoMapperRequestKey <TSource, TDestination>)response_AutoMapperRequestKey);
        }
Exemplo n.º 3
0
 public AutoMapperRequestKeyGen
 (
     IMapTypeDefinition sourceTypeGenDef,
     IMapTypeDefinition destinationTypeGenDef,
     IAutoMapperConfigDetails autoMapperConfigDetails,
     Func <IAutoMapperRequestKeyGen, IMapper> autoMapperBuilder)
 {
     SourceTypeDef           = sourceTypeGenDef;
     DestinationTypeDef      = destinationTypeGenDef;
     AutoMapperConfigDetails = autoMapperConfigDetails;
     AutoMapperBuilder       = autoMapperBuilder;
 }
Exemplo n.º 4
0
        //public Func<TDestination, TSource> SourceConstructor => MappingConfiguration.SourceConstructor;
        //public Func<TSource, TDestination> DestinationConstructor => MappingConfiguration.DestinationConstructor;

        #endregion

        #region Constructor

        public AutoMapperRequestKey
        (
            IMapTypeDefinition sourceMapTypeDef,
            IMapTypeDefinition destinationMapTypeDef,
            IAutoMapperConfigDetails autoMapperConfigDetails,
            IConfigureAMapper <TSource, TDestination> mappingConfiguration,
            IAutoMapperBuilder <TSource, TDestination> autoMapperBuilder
        )
            : base
            (
                sourceMapTypeDef,
                destinationMapTypeDef,
                autoMapperConfigDetails,
                autoMapperBuilder.AutoMapperBuilderGen
            )
        {
            MappingConfiguration = mappingConfiguration;
        }
Exemplo n.º 5
0
        // Submit a request to queue up the creation of a Raw AutoMapper, and receive the RequestKey.
        private IAutoMapperRequestKey <TSource, TDestination> SubmitRawAutoMapperRequest <TSource, TDestination>
        (
            PropModelType propModel,
            IConfigureAMapper <TSource, TDestination> mappingConfiguration,
            IHaveAMapperConfigurationStep configStarterForThisRequest
        )
            where TDestination : class, IPropBag
        {
            IMapTypeDefinition srcMapTypeDef
                = _mapTypeDefinitionProvider.GetTypeDescription(typeof(TSource), uniqueRef: propModel, uniqueToken: null);

            IMapTypeDefinition dstMapTypeDef
                = _mapTypeDefinitionProvider.GetTypeDescription(typeof(TDestination), uniqueRef: propModel, uniqueToken: null);

            CheckRunTimeType(propModel, typeof(TDestination));

            IAutoMapperConfigDetails pbMapperConfigDetails
                = new PropBagMapperConfigDetails
                  (
                      PROP_BAG_MAPPER_CONFIG_DETAIL_EXTENSION_SOURCE_ID,
                      mappingConfiguration.PackageName,
                      propModel
                  );

            IAutoMapperRequestKey <TSource, TDestination> autoMapperRequestKey
                = _autoMapperService.SubmitRawAutoMapperRequest <TSource, TDestination>
                  (
                      srcMapTypeDef,
                      dstMapTypeDef,
                      pbMapperConfigDetails,
                      mappingConfiguration,
                      configStarterForThisRequest
                  );

            return(autoMapperRequestKey);
        }