/// <summary> /// Builds the automatic resolver mapper for compatibles properties using a service key for dedicated context. /// </summary> /// <param name="keyService">The key service.</param> /// <param name="sourceType">Type of the source.</param> /// <param name="destinationType">Type of the destination.</param> /// <returns></returns> public bool BuildAutoResolverMapper(object keyService, Type sourceType, Type destinationType) { ISourceMapper mapper = new SourceMapper(sourceType, destinationType, FactoryMapper.GetDefaultPropertyMappers(sourceType, destinationType, this)); return(this.RegisterMapper(mapper, keyService)); }
/// <summary> /// Builds the automatic resolver mapper for compatibles properties using the given key service for dedicated context and actions. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TDestination">The type of the destination.</typeparam> /// <param name="keyService">The key service.</param> /// <param name="beforeMapping">The before mapping.</param> /// <param name="afterMapping">The after mapping.</param> /// <returns></returns> public bool BuildAutoResolverMapper <TSource, TDestination>(object keyService, Action <TDestination> beforeMapping, Action <TDestination> afterMapping) where TSource : class where TDestination : class { ISourceMapper mapper = new SourceMapper <TSource, TDestination>( FactoryMapper.GetDefaultPropertyMappers <TSource, TDestination>(this), beforeMapping, afterMapping); return(this.RegisterMapper(mapper, keyService)); }
/// <summary> /// Builds the mapper. /// </summary> /// <param name="beforeMapping">The before mapping.</param> /// <param name="afterMapping">The after mapping.</param> /// <param name="defaultKey">The default key.</param> /// <returns></returns> public ISourceMapper <TSource, TDestination> BuildMapper(Action <TDestination> beforeMapping, Action <TDestination> afterMapping, string defaultKey = null) { var mapper = new SourceMapper <TSource, TDestination>(this.propertyMappers, beforeMapping, afterMapping); if (this.isObservable) { if (defaultKey == null) { this.observer.RegisterMapper <ISourceMapper <TSource, TDestination> >(mapper); } else { this.observer.RegisterMapper <ISourceMapper <TSource, TDestination> >(mapper, defaultKey); } } return(mapper); }