Skip to content

Conversation

NormanGiHu
Copy link

@NormanGiHu NormanGiHu commented Mar 26, 2021

This is how i use the new extension methods to write history for added entries.
Perhaps other people can use this too.

Usage Example:

var addedEntries = dbContext.ChangeTracker
.Entries()
.Where(e => e.State == EntityState.Added)
.ToArray();
dbContext.EnsureAutoHistory();
dbContext.SaveChanges();
dbContext.EnsureAddedHistory(addedEntries);
dbContext.SaveChanges();

Usage Example:

var addedEntries = this.ChangeTracker
                                   .Entries()
                                   .Where(e => e.State == EntityState.Added)
                                   .ToArray();
dbContext.EnsureAutoHistory();
dbContext.SaveChanges();
dbContext.EnsureAddedHistory(addedEntries);
dbContext.SaveChanges();
@rigofunc rigofunc merged commit cc0c8d4 into arch:master May 28, 2021
@rigofunc
Copy link
Member

thks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants