I need to query my Context in EF Core to get Added Items, but not Saved (EntityState.Added)
Example query:
var list = await _databaseContext.Set<PersonModel>().ToListAsync();
I see one topic about ChangeTracker, but I don't know how to implement here on this scenario. Is it possible on EF Core?
You can access the changes with the ChangeTracker
property on your DbContext
:
var added = _databaseContext.ChangeTracker.Entries().Where(x => x.State == EntityState.Added);