My colleague and I developed software divided into two parts. The first is the WPF program, and the second is the Windows service.
Both of them work in the same database and have their own framework context.
This works, but now I have to add a new function that gives us some problems.
I get addEntities to do some things on it before 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 while the Windows service is not writing anything to the database. It is like it is changing dbContext and my program no longer sees the added elements.
Do you know how to avoid this problem?
source
share