// 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); }
// 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); }
// 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); }
// Typed Submit with Mapping Configuration. public IPropBagMapperRequestKey <TSource, TDestination> SubmitPropBagMapperRequest <TSource, TDestination> ( PropModelType propModel, IConfigureAMapper <TSource, TDestination> mappingConfiguration, IHaveAMapperConfigurationStep configStarterForThisRequest, IPropFactory propFactory = null ) where TDestination : class, IPropBag { // Use the AutoMapperService to register a 'raw' request. IAutoMapperRequestKey <TSource, TDestination> autoMapperRequestKey = this.SubmitRawAutoMapperRequest <TSource, TDestination> ( propModel, mappingConfiguration, configStarterForThisRequest ); // Note: at this point we can fetch the Mapper Config Details. //IAutoMapperConfigDetails autoMapperConfigDetails = autoMapperRequestKey.AutoMapperConfigDetails; //IPropBagMapperConfigDetails propBagMapperConfigDetails = (IPropBagMapperConfigDetails)autoMapperConfigDetails; // Create a MapperBuilder for this request. IPropBagMapperBuilder <TSource, TDestination> propBagMapperBuilder = BuildTheAutoMapperBuilder <TSource, TDestination>(/*configStarterForThisRequest*/); // Create the PropBag Mapper Request. IPropBagMapperRequestKey <TSource, TDestination> propBagMapperRequestKey = new PropBagMapperRequestKey <TSource, TDestination> ( propBagMapperBuilder, autoMapperRequestKey // This contains a reference to the propModel. //, //propModel ); // Note: at this point we can fetch the Mapper Config Details from the PropBagMapperRequestKey. //IPropBagMapperConfigDetails propBagMapperConfigDetails = propBagMapperRequestKey.PropBagMapperConfigDetails; //// Store the request //IPropBagMapperKeyGen newMapRequest = RegisterPropBagMapperRequest(typedMapperRequest); //return (IPropBagMapperKey<TSource, TDestination>)newMapRequest; // We could store the request in the PropBagMapper Cache, but it would not be used. return(propBagMapperRequestKey); }
// Gen Submit public IAutoMapperRequestKeyGen SubmitRawAutoMapperRequest ( Type sourceType, Type destinationType, IAutoMapperConfigDetails autoMapperConfigDetails, string configPackageName, IHaveAMapperConfigurationStep configStarterForThisRequest ) { AutoMapperReqSubDelegate mapperRequestSubmitter = GetAutoMapperReqSubDelegate(sourceType, destinationType); IAutoMapperRequestKeyGen result = mapperRequestSubmitter(autoMapperConfigDetails, sourceType, destinationType, configPackageName, configStarterForThisRequest, this); return(result); }
// Typed Submit with ConfigPackageName public IPropBagMapperRequestKey <TSource, TDestination> SubmitPropBagMapperRequest <TSource, TDestination> ( PropModelType propModel, string configPackageName, IHaveAMapperConfigurationStep configStarterForThisRequest = null, IPropFactory propFactory = null ) where TDestination : class, IPropBag { // Lookup the package name and return a mapping configuration. IConfigureAMapper <TSource, TDestination> mappingConfiguration = GetTheMappingConfiguration <TSource, TDestination>(configPackageName); var result = SubmitPropBagMapperRequest <TSource, TDestination>(propModel, mappingConfiguration, configStarterForThisRequest, propFactory); return(result); }
public AbstractMapperConfigurationGen ( string packageName, List <IHaveAMapperConfigurationStep> configSteps, IHaveAMapperConfigurationStep configStarter, bool requiresWrapperTypeEmitServices, bool supportsMapFrom ) { PackageName = packageName; ConfigStarter = configStarter; _ourConfigurationSteps = MakeACopy(configSteps); ConfigurationSteps = _ourConfigurationSteps.AsReadOnly(); SupportsMapFrom = supportsMapFrom; RequiresWrappperTypeEmitServices = requiresWrapperTypeEmitServices; }
// 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); }
public SimpleMapperConfiguration ( string packageName, List <IHaveAMapperConfigurationStep> configSteps, IMapperConfigurationExpressionProvider <TSource, TDestination> finalConfigActionProvider, Func <TDestination, TSource> sourceConstructor, Func <TSource, TDestination> destinationConstructor, IHaveAMapperConfigurationStep configStarter, bool requiresWrappperTypeEmitServices, bool supportsMapFrom ) : base ( packageName, configSteps, configStarter, requiresWrappperTypeEmitServices, supportsMapFrom ) { FinalConfigActionProvider = finalConfigActionProvider; SourceConstructor = sourceConstructor; DestinationConstructor = destinationConstructor; }
public SimpleMapperConfigurationBuilder(IHaveAMapperConfigurationStep configStarter) : base(configStarter) { }
private IAutoMapperBuilder <TSource, TDestination> BuildTheAutoMapperBuilder <TSource, TDestination>(IHaveAMapperConfigurationStep configStarterForThisRequest) { // TODO: check to make sure that the "configStarterForThisRequest" value is being sent to the correct place. // TODO: Make the method: GetAutoMapperBuilder on IAutoMapperBuilderProvider accept a // configStarterForThisRequest parameter. // Then create a new interface: IBuildMapperConfigurations_Provider // an implementation of this interface can be injected into the IBuildAutoMapper instance // so that the AutoMapperBuilder can create the ConfigurationBuilder for this request // and give it the configStarterForThisRequest value. // Create a Configuration Builder for this request. IMapperConfigurationBuilder <TSource, TDestination> propBagMapperConfigurationBuilder = new SimpleMapperConfigurationBuilder <TSource, TDestination>(configStarter: configStarterForThisRequest); // Create a MapperBuilder for this request. IAutoMapperBuilder <TSource, TDestination> autoMapperBuilder = _autoMapperBuilderProvider.GetAutoMapperBuilder <TSource, TDestination> ( propBagMapperConfigurationBuilder ); return(autoMapperBuilder); }
public SimpleMapperConfigurationBuilderGenBase(IHaveAMapperConfigurationStep configStarter) { ConfigStarter = configStarter; _action = null; Configs = null; }