INNER CODE UNIT · C#
sortedDescriptors
daxnet/apworks-core · src/Apworks.EventStore.AdoNet/AdoNetEventStore.cs:135
var sortedDescriptors = descriptors.OrderBy(desc => desc.EventTimestamp);
foreach (var descriptor in sortedDescriptors)
{
var parameters = this.GenerateInsertParameters(command, descriptor, false);
if (!hasCommandPrepared)
{
sql = $"{sql} ({string.Join(", ", parameters.Select(x => x.Key))})";
command.CommandText = sql;
command.Transaction = transaction;
hasCommandPrepared = true;
}
command.Parameters.Clear();
parameters.Select(p => p.Value).ToList().ForEach(p => command.Parameters.Add(p));
command.ExecuteNonQuery();
}
}
transaction.Commit();
}