Beispiel #1
0
 //在线程中公用一个DBSession对象
 public IDAL.IDBSession GetSession()
 {
     IDAL.IDBSession dbsession = CallContext.GetData(typeof(DBSessionFactory).Name) as DBSession;
     if (dbsession == null)
     {
         dbsession = new DBSession();
         CallContext.SetData(typeof(DBSessionFactory).Name, dbsession);
     }
     return dbsession;
 }
 public IDBSession GetDBSession()
 {
     //从当前线程中 获取 DBContext 数据仓储 对象
     IDAL.IDBSession dbSesion = CallContext.GetData(typeof(DBSessionFactory).Name) as DBSession;
     if (dbSesion == null)
     {
         dbSesion = new DBSession();
         CallContext.SetData(typeof(DBSessionFactory).Name, dbSesion);
     }
     return dbSesion;
 }