/// <summary> /// Create a new BPI, and serialize the changeset if not in memory /// </summary> internal static async Task <BatchPartInfo> CreateBatchPartInfoAsync(int batchIndex, SyncSet set, string fileName, string directoryFullPath, bool isLastBatch, BaseOrchestrator orchestrator = null) { BatchPartInfo bpi = null; // Create a batch part // The batch part creation process will serialize the changesSet to the disk // Serialize the file ! await SerializeAsync(set.GetContainerSet(), fileName, directoryFullPath, orchestrator); bpi = new BatchPartInfo { FileName = fileName }; bpi.Index = batchIndex; bpi.IsLastBatch = isLastBatch; // Even if the set is empty (serialized on disk), we should retain the tables names if (set != null) { bpi.Tables = set.Tables.Select(t => new BatchPartTableInfo(t.TableName, t.SchemaName, t.Rows.Count)).ToArray(); bpi.RowsCount = set.Tables.Sum(t => t.Rows.Count); } return(bpi); }
/// <summary> /// Create a new BPI, and serialize the changeset if not in memory /// </summary> internal static BatchPartInfo CreateBatchPartInfo(int batchIndex, SyncSet set, string fileName, string directoryFullPath, bool isLastBatch) { BatchPartInfo bpi = null; // Create a batch part // The batch part creation process will serialize the changesSet to the disk // Serialize the file ! Serialize(set.GetContainerSet(), fileName, directoryFullPath); bpi = new BatchPartInfo { FileName = fileName }; bpi.Index = batchIndex; bpi.IsLastBatch = isLastBatch; // Even if the set is empty (serialized on disk), we should retain the tables names if (set != null) { bpi.Tables = set.Tables.Select(t => new BatchPartTableInfo(t.TableName, t.SchemaName)).ToArray(); } return(bpi); }