0

我正在寻找配置 Microsoft.Practices.Unity.IUnityContainer 以管理 asp.net 应用程序的 nHibernate ISessionFactory 生命周期的最佳方法。我还希望统一注入我的 IDataLayer 实现,该实现通过在其托管的 ISessionFactory 上调用 GetCurrentSession 来获取 NHibernate.ISession 的实例。

请在您的答案中包含代码:-)

4

1 回答 1

0

You can also use a direct dependency to ISession and use some NHConversationLifetimeManager. Or look at Spring's ISession management (the Java one for instance). I think they already worked on this subject (ie Hibernate ISession & Dependency Injection).

Sorry, no code!

于 2009-10-12T10:31:26.927 回答