private IEnumerable <ImportDataChunk <LookupChunkData> > GetLookupChunkData(ImportParameters importParameters) { var importColumns = importParameters.Columns.Where(c => c.Destinations.Any(d => d.FindColumnTypeUId() == DataValueTypeUId)); var entitiesChunks = importParameters.Entities.SplitOnChunks(importParameters.ChunkSize); var result = new List <ImportDataChunk <LookupChunkData> >(); if (!importColumns.Any()) { return(result); } foreach (var entities in entitiesChunks) { var processor = new LookupValuesToProcess(UserConnection); foreach (var entity in entities) { foreach (var column in importColumns) { var columnValue = entity.FindColumnValue(column); if (columnValue == null) { continue; } foreach (var destination in column.Destinations) { processor.Add(entity, column, columnValue, destination); } } } result.Add(GetImportDataChunk(importParameters.ImportSessionId, processor.SaveState())); } return(result); }
public ImportDataChunk <LookupChunkData> CreateChunk(ImportDataChunk <EntityChunkData> chunk) { var processor = new LookupValuesToProcess(_userConnection); foreach (var entityMemento in chunk.Data.Entities) { var entity = ImportEntity.CreateFromMemento(entityMemento); processor.Add(entity, _lookupColumns); } var newLookupChunk = CreateChunk(processor.SaveState()); return(newLookupChunk); }