Reputation: 17
I have four VS projects in the same solution with the following architecture:
Admin
and User
project share the same layers Service
/ Repository
but each one has its own server (user.domain.com
and admin.domain.com
) so they are in different IIS pools.
I publish them separately, however, when I make some change in admin it does not take any effect in the final user's app due the Entity Framework caching. My repository uses a static context, I cannot lose the entities changes so I cannot turn it into a local context.
I tried this in user's app:
foreach (var entity in _context.ChangeTracker.Entries())
{
entity.Reload();
}
worked but the application got too slow.
Is there a good way to identify database changes using the same EF layer in two different applications?
Or disable only User
's app caching..
I am using EF6 and .NET 4.6.1
Thanks
Upvotes: 0
Views: 170
Reputation: 88996
My repository uses a static context
Don't do that. The context should be transient, or scoped to the HTTP request.
Upvotes: 3