Reputation: 215
I am using Unity HierarchicalLifetimeManager to resolve EF dbcontext with constructor injection.
For some reason i want to recreate the dbcontext manually, e.g. after 1000 records committed.
I have tried LifetimeManager.SetValue(newValue)
but it does not work, still the constructor injection injects the old dbcontext.
What i am missing here?
Upvotes: 2
Views: 168
Reputation: 215
I have found the solution.
After called LifetimeManager.SetValue(newValue)
i have to resolve the instances which are all sharing the dbcontext.
Upvotes: 2