protected MemberMapper(MappingContainer container, MemberMapOptions options, MappingMember targetMember, ValueConverter converter) { _container = container; _options = options; TargetMember = targetMember; _converter = converter; }
internal ConventionContext(MappingContainer container, Type sourceType, Type targetType, MemberMapOptions options) { _container = container; SourceType = sourceType; TargetType = targetType; Options = options; SourceMembers = new MappingMemberCollection(GetMembers(sourceType, true, false)); TargetMembers = new MappingMemberCollection(GetMembers(targetType, false, true)); }
public LambdaMemberMapper(MappingContainer container, MemberMapOptions options, MappingMember targetMember, Func <TSource, TMember> expression) : base(container, options, targetMember, null) { if (expression == null) { throw new ArgumentNullException(nameof(expression)); } _expression = expression; }
public DefaultMemberMapper(MappingContainer container, MemberMapOptions options, MappingMember targetMember, MappingMember sourceMember, ValueConverter converter) : base(container, options, targetMember, converter) { if (sourceMember == null) { throw new ArgumentNullException(nameof(sourceMember)); } _sourceMember = sourceMember; }
public static bool TryCreate(Type sourceType, Type targetType, MappingContainer container, out ValueConverter converter) { converter = null; Type sourceElementType, targetElementType; if (sourceType.IsEnumerable(out sourceElementType) && targetType.IsEnumerable(out targetElementType)) { converter = new EnumerableValueConverter(container, sourceElementType, targetElementType); return(true); } return(false); }
public static TypeMapper <TSource, TTarget> GetInstance(MappingContainer container) { TypeMapper <TSource, TTarget> instance; if (!_instances.TryGetValue(container, out instance)) { lock (_instances) { if (!_instances.TryGetValue(container, out instance)) { instance = new TypeMapper <TSource, TTarget>(container); _instances.Add(container, instance); } } } return(instance); }
public static InstanceMapper <TSource, TTarget> GetInstance(MappingContainer container) { InstanceMapper <TSource, TTarget> mapper; if (!_mappers.TryGetValue(container, out mapper)) { lock (_mappers) { if (!_mappers.TryGetValue(container, out mapper)) { mapper = new InstanceMapper <TSource, TTarget>(container); _mappers.Add(container, mapper); } } } return(mapper); }
public static bool TryCreate(Type sourceType, Type targetType, MappingContainer container, out ValueMapper mapper) { mapper = null; Type sourceElementType, targetElementType; if (sourceType.IsEnumerable(out sourceElementType) && targetType.IsEnumerable(out targetElementType)) { #if NETSTANDARD var sourceElementTypeInfo = sourceElementType.GetTypeInfo(); var targetElementTypeInfo = targetElementType.GetTypeInfo(); #else var sourceElementTypeInfo = sourceElementType; var targetElementTypeInfo = targetElementType; #endif if (!sourceElementTypeInfo.IsValueType && !sourceElementTypeInfo.IsPrimitive && !targetElementTypeInfo.IsValueType && !targetElementTypeInfo.IsPrimitive) { mapper = new EnumerableMapper(container, sourceElementType, targetElementType); return(true); } } return(false); }
public EnumerableMapper(MappingContainer container, Type sourceElementType, Type targetElementType) { _container = container; _sourceElementType = sourceElementType; _targetElementType = targetElementType; }
private TypeMapper(MappingContainer container) { _container = container; }
public static TypeMapper <TSource, TTarget> GetInstance(MappingContainer container) { return(_instances.GetOrAdd(container, key => new TypeMapper <TSource, TTarget>(key))); }
public static bool TryGetInstance(MappingContainer container, out TypeMapper <TSource, TTarget> mapper) { return(_instances.TryGetValue(container, out mapper)); }
public EnumerableConverterBuilder(MappingContainer container) { _container = container; }
public ValueConverterCollection(MappingContainer container) { _container = container; }
private InstanceMapper(MappingContainer container) { _converter = container.GetMapFunc <TSource, TTarget>(); _mapper = container.GetMapAction <TSource, TTarget>(); }
public MemberMapperCollection(MappingContainer container, MemberMapOptions options) { _container = container; _options = options; }