问题
My colleague and me developed a software, divided in two parts. The first is a WPF program while the second is a windows service.
Both of them work on the same database and have their entity framework context.
It works, but now I have to add a new feature giving us some troubles.
I get the addedEntities to do some stuff on it before the saveChanges:
var addedEntities = Entities.dbContext.ChangeTracker.Entries().Where(x => x.State == EntityState.Added && x.Entity.GetType().Name == "mytable").Select(x => x.Entity as mytable).ToList();
This works fine until the windows service writes something in the database. It's like it changhes the dbContext and my program doesn't see the addedEntities anymore.
Do you know how to avoid this issue?
来源:https://stackoverflow.com/questions/41982691/one-database-two-applications-two-dbcontext