Exemple #1
0
            // The Typed method for RawAutoMappers
            static IAutoMapperRequestKey <TSource, TDestination> SubmitRawAutoMapperRequest <TSource, TDestination>
            (
                IAutoMapperConfigDetails autoMapperConfigDetails,
                Type sourceType,
                Type destinationType,
                string configPackageName,
                IHaveAMapperConfigurationStep configStarterForThisRequest,
                IAutoMapperService autoMapperProvider
            )
            {
                IMapTypeDefinition srcMapTypeDef = new MapTypeDefinition(typeof(TSource));
                IMapTypeDefinition dstMapTypeDef = new MapTypeDefinition(typeof(TDestination));

                IAutoMapperRequestKey <TSource, TDestination> result
                    = autoMapperProvider.SubmitRawAutoMapperRequest <TSource, TDestination>
                      (
                          srcMapTypeDef: srcMapTypeDef,
                          dstMapTypeDef: dstMapTypeDef,
                          configuationDetails: autoMapperConfigDetails,
                          configPackageName: configPackageName,
                          configStarterForThisRequest: configStarterForThisRequest
                      );

                return(result);
            }
        // 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);
        }