问题描述
usingFluentNHibernate.Cfg;usingFluentNHibernate.Cfg.Db;usingNHibernate;usingNHibernate.Tool.hbm2ddl;usingSystem;usingSystem.Linq;usingSystem.Text;usingSystem.Configuration;namespaceGluingSeq.DALayer{publicstaticclassNHibernateHelper{privatestaticISessionFactory_sessionFactory;privatestaticreadonlyobjectlockObj=newobject();privatestaticISessionFactorySessionFactory{get{if(_sessionFactory==null){lock(lockObj){InitializeSessionFactory();}}return_sessionFactory;}}privatestaticvoidInitializeSessionFactory(){_sessionFactory=newConfiguration().Configure(AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"hibernate.cfg.xml").BuildSessionFactory();}publicstaticISessionOpenSession(){returnSessionFactory.OpenSession();}}}
解决方案
时间: 2024-09-22 17:52:38