Ejemplo n.º 1
0
        /// <summary>
        /// 获取 BLL 业务逻辑层 大接口
        /// </summary>
        /// <returns></returns>
        public IBLLSession GetBLLSession()
        {
            //从当前线程中 获取 DBContext 数据仓储 对象
            IBLLSession iBLLSession = System.Runtime.Remoting.Messaging.CallContext.GetData(typeof(BLLSessionFactory).Name) as IBLLSession;

            if (iBLLSession == null)
            {
                //通过反射创建 IDbSession
                //1.通过配置文件获取dll的位置
                string dllPath = Common.ConfigurationHelper.AppSettingMapPath("BLLSessionFactoryDLL");
                //string dllPath = System.Configuration.ConfigurationSettings.AppSettings["BLLSessionFactoryDLL"].ToString();
                //2.通过配置文件获取 DbSessionFactory 的全名称
                string factoryType = Common.ConfigurationHelper.AppSetting("BLLSessionFactoryType");
                //3.通过反射创建实例
                //3.1加载程序集
                Assembly dll = Assembly.LoadFrom(dllPath);
                //3.2获得DbSessionFactory 的 Type
                Type tFactory = dll.GetType(factoryType);
                //3.3反射创建 IBLLSessionFactory 实体对象
                IBLLSessionFactory BLLSession = Activator.CreateInstance(tFactory) as IBLLSessionFactory;
                iBLLSession = BLLSession.GetBLLSession();
                System.Runtime.Remoting.Messaging.CallContext.SetData(typeof(BLLSessionFactory).Name, iBLLSession);
            }
            return(iBLLSession);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取BLLSession
        /// </summary>
        /// <returns></returns>
        public IBLLSession GetBllSession()
        {
            IBLLSession bllSession = CallContext.GetData(typeof(BLLSessionFactory).Name) as BLLSession;

            if (bllSession == null)
            {
                bllSession = new BLLSession();
                CallContext.SetData(typeof(BLLSessionFactory).Name, bllSession);
            }
            return(bllSession);
        }
Ejemplo n.º 3
0
        public IBLLSession GetBLLSession()
        {
            //从当前线程中 获取 DBContext 数据仓储 对象
            IBLLSession iBLLSession = System.Runtime.Remoting.Messaging.CallContext.GetData(typeof(BLLSessionFactory).Name) as IBLLSession;

            if (iBLLSession == null)
            {
                iBLLSession = new BLLSession();
                System.Runtime.Remoting.Messaging.CallContext.SetData(typeof(BLLSessionFactory).Name, iBLLSession);
            }
            return(iBLLSession);
        }
Ejemplo n.º 4
0
 private OperContext()
 {
     BLLSession = SpringHelper.GetObject <IBLLSession>("BLLSession");
 }
Ejemplo n.º 5
0
 private OperContext()
 {
     BllSession = new BLLSessionFactory().GetBLLSesson();// SpringHelper.GetObject<IBLLSession>("BLLSession");
 }
Ejemplo n.º 6
0
 public OperateContext()
 {
     BLLSession = DI.AutoFacHelper.GetObject<IBLLSession>("BLLSession");
 }
Ejemplo n.º 7
0
 public OperateContext()
 {
     bLLSession = DI.StringHelper.GetObject <IBLLSession>("BLLSession");
 }
Ejemplo n.º 8
0
 public OperateContext()
 {
     bllSession = SpringHelper.GetObject <IBLLSessionFactory>("BLLSessionFactory").GetBLLSession();
 }