Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathanMagnan/fd89c3c6ffaf836198d1a84a6cc3d916 to your computer and use it in GitHub Desktop.
Save JonathanMagnan/fd89c3c6ffaf836198d1a84a6cc3d916 to your computer and use it in GitHub Desktop.
List<AuditEntry> auditEntries = new List<AuditEntry>();
using (var ctx = new EntitiesContext())
{
ctx.BulkSaveChanges(list, operation =>
{
operation.UseAudit = true;
operation.BulkOperationExecuted = bulkOperation => auditEntries.AddRange(bulkOperation.AuditEntries);
});
}
foreach (var entry in auditEntries)
{
foreach (var value in entry.Values)
{
var oldValue = value.OldValue;
var newValue = value.NewValue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment