public Expression GetPopulation( EnumerablePopulationBuilder builder, IObjectMappingData enumerableMappingData) { if (builder.ElementTypesAreSimple) { builder.AssignSourceVariableFrom(s => s.SourceItemsProjectedToTargetType().ExcludingTargetItems()); builder.AssignTargetVariable(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); } if (builder.ElementsAreIdentifiable) { builder.CreateCollectionData(); builder.MapIntersection(enumerableMappingData); builder.AssignSourceVariableFrom(s => s.CollectionDataNewSourceItems()); builder.AssignTargetVariable(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); } builder.AssignSourceVariableFromSourceObject(); builder.AssignTargetVariable(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); }
public static Expression Create(EnumerablePopulationBuilder builder, IObjectMappingData enumerableMappingData) { builder.AssignSourceVariableFromSourceObject(); builder.AssignTargetVariable(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); }
public static Expression Create( EnumerablePopulationBuilder builder, IObjectMappingData enumerableMappingData) { if (builder.ElementTypesAreSimple) { if (builder.TargetTypeHelper.IsReadOnly) { builder.PopulateTargetVariableFromSourceObjectOnly(); return(builder); } builder.AssignSourceVariableFrom(s => s.SourceItemsProjectedToTargetType()); builder.AssignTargetVariable(); builder.RemoveAllTargetItems(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); } if (builder.ElementsAreIdentifiable) { builder.CreateCollectionData(); builder.MapIntersection(enumerableMappingData); builder.AssignSourceVariableFrom(s => s.CollectionDataNewSourceItems()); builder.AssignTargetVariable(); builder.RemoveTargetItemsById(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); } builder.AssignSourceVariableFromSourceObject(); builder.AssignTargetVariable(); builder.RemoveAllTargetItems(); builder.AddNewItemsToTargetVariable(enumerableMappingData); return(builder); }