protected override void Map(IEnumerable <MapTarget> MapTypes) { foreach (var map in MapTypes) { var src = map.target; var trgt = map.source; if (!MapSetter.IscomplexMapping <IComplexType>(map)) { if (!typeof(ITarget).IsAssignableFrom(map.target)) { CreateMap(src, trgt) .ForSourceMember("Id", opt => opt.Ignore()); } //.ReverseMap(); else if (MapSetter.ContainsColumn(src, "Id")) { CreateMap(src, trgt) .ForSourceMember("Id", opt => opt.Ignore()); } else { CreateMap(src, trgt); } } else { if (MapSetter.ContainsColumn(src, "Id")) { CreateMap(src, trgt) .ForSourceMember("Id", opt => opt.Ignore()) .ProjectUsing(s => MapSetter.EntityDestination <ITarget, IComplexType>(s, trgt)); } else { CreateMap(src, trgt) .ProjectUsing(s => MapSetter.EntityDestination <ITarget, IComplexType>(s, trgt)); } } } }
protected virtual void Map(IEnumerable <MapTarget> MapTypes) { ShouldMapProperty = pi => pi.PropertyType != typeof(IList <>); foreach (var map in MapTypes) { if (!MapSetter.IscomplexMapping <IComplexType>(map) && !map.IsCompexMapping) { if (!typeof(ITarget).IsAssignableFrom(map.target)) { CreateMap(map.source, map.target) .ReverseMap(); } else { CreateMap(map.source, map.target) .ReverseMap(); } } else { if (map.IsCompexMapping) { CreateMap(map.source, map.target, MemberList.None) .ProjectUsing(src => MapSetter.ModelDestination(src, map.target)); CreateMap(map.target, map.source) .ProjectUsing(src => MapSetter.EntityDestination(src, map.source)); } else { CreateMap(map.source, map.target, MemberList.None) .ProjectUsing(src => MapSetter.ModelDestination <ITarget, IComplexType>(src, map.target)); CreateMap(map.target, map.source) .ProjectUsing(src => MapSetter.EntityDestination <ITarget, IComplexType>(src, map.source)); } } } }