2013-10-29 19 views
2

我正在使用Unity HierarchicalLifetimeManager通過構造函數注入來解析EF dbcontext。無法手動重新創建Unity容器控制對象(EF dbcontext)

由於某種原因,我想手動重新創建dbcontext,例如,提交1000條記錄後。

我試過LifetimeManager.SetValue(newValue)但它不起作用,仍然構造函數注入注入舊的dbcontext。

我在這裏失蹤了什麼?

+0

答案:在調用LifetimeManager.SetValue(newValue)後,我必須解決所有共享dbcontext的實例。 –

回答

2

我找到了解決方案。

在調用LifetimeManager.SetValue(newValue)之後,我必須解決所有共享dbcontext的實例。

相關問題