protected CollectionSynchronizationCompiler(IUnresolvedMapping itemMapping, IEqualityRules equalityRules, Delegate childPostprocessing, bool mapNullToEmpty) { this.aItemMapping = itemMapping; (this.aSelectIdFrom, this.aSelectIdTo) = equalityRules.GetIdSelectors(); this.aChildPostprocessing = childPostprocessing; this.aMapNullToEmpty = mapNullToEmpty; }
internal CollectionWithMap(MappingDefinitionInformation mappingDefinition, IEqualityRules equalityRules, bool mapNullToEmpty) { this.aItemMapping = mappingDefinition.UnresolvedMappings.GetUnresolvedMapping(EnumerableReflection <TFrom> .ItemType, EnumerableReflection <TTo> .ItemType); var childPostprocessing = mappingDefinition.GetChildPostprocessing(typeof(TTo), EnumerableReflection <TTo> .ItemType); if (ArrayMappingCompiler <TFrom, TTo> .ShouldUse()) { this.aMappingExpression = new ArrayMappingCompiler <TFrom, TTo>(this.aItemMapping, childPostprocessing, mapNullToEmpty); } else if (ListMappingCompiler <TFrom, TTo> .ShouldUse()) { this.aMappingExpression = new ListMappingCompiler <TFrom, TTo>(this.aItemMapping, childPostprocessing, mapNullToEmpty); } else if (ConstructorMappingCompiler <TFrom, TTo> .ShouldUse()) { this.aMappingExpression = new ConstructorMappingCompiler <TFrom, TTo>(this.aItemMapping, childPostprocessing, mapNullToEmpty); } else { throw new InvalidMappingException($"Cannot find proper method to map to a collection of type {typeof(TTo).FullName}"); } this.aMapEqualityExpression = new EnumerableComparisionCompiler <TFrom, TTo>(this.aItemMapping, equalityRules, mapNullToEmpty); }
public bool TryGetUnresolvedMapping <TFrom, TTo>(out IUnresolvedMapping <TFrom, TTo> mapping) { if (this.aDefinitionContainer.ContainsMapping(typeof(TFrom), typeof(TTo))) { mapping = new UnresolvedMapping <TFrom, TTo>(this.aContainer); return(true); } mapping = null; return(false); }
public bool TryGetUnresolvedMapping(Type from, Type to, out IUnresolvedMapping mapping) { if (this.aDefinitionContainer.ContainsMapping(from, to)) { mapping = new UnresolvedMapping(this.aContainer, from, to); return(true); } mapping = null; return(false); }
public PairedMembers(IMember from, IMember to, IUnresolvedMapping mapping) { if (!from.CanPairWith(to)) { throw new Exception($"Cannot map {from} and {to} together"); } this.From = from; this.To = to; this.Mapping = mapping; }
public ArrayMappingCompiler(IUnresolvedMapping itemMapping, Delegate childPostprocessing, bool mapNullToEmpty) : base(itemMapping, childPostprocessing, mapNullToEmpty) { }
protected CollectionMappingCompiler(IUnresolvedMapping itemMapping, Delegate childPostprocessing, bool mapNullToEmpty) { this.aItemMapping = itemMapping; this.aChildPostprocessing = childPostprocessing; this.aMapNullToEmpty = mapNullToEmpty; }
public ArraySynchronizationCompiler(IUnresolvedMapping itemMapping, IEqualityRules equalityRules, Delegate childPostprocessing, bool mapNullToEmpty) : base(itemMapping, equalityRules, childPostprocessing, mapNullToEmpty) { }
public SubClassConversion(Type from, Type to, IUnresolvedMapping mapping) { this.From = from; this.To = to; this.Mapping = mapping; }
public EnumerableComparisionCompiler(IUnresolvedMapping itemMapping, IEqualityRules equalityRules, bool mapNullToEmpty) { this.aItemMapping = itemMapping; this.aEqualityRules = equalityRules; this.aMapNullToEmpty = mapNullToEmpty; }