/// <summary>
        /// 获取线程上下文
        /// </summary>
        /// <returns></returns>
        public ModelBaseContext GetDataContext()
        {
            ModelBaseContext libraryDataContext = null;

            if (_libraryDataContexts.Contains(GetThreadName()))
            {
                libraryDataContext = (ModelBaseContext)_libraryDataContexts[GetThreadName()];
            }

            return(libraryDataContext);
        }
 /// <summary>
 /// 执行缓存
 /// </summary>
 /// <param name="libraryDataContext"></param>
 public void Store(ModelBaseContext libraryDataContext)
 {
     if (_libraryDataContexts.Contains(GetThreadName()))
     {
         _libraryDataContexts[GetThreadName()] = libraryDataContext;
     }
     else
     {
         _libraryDataContexts.Add(GetThreadName(), libraryDataContext);
     }
 }
        /// <summary>
        /// 获取上下文
        /// </summary>
        /// <returns></returns>
        public ModelBaseContext GetDataContext()
        {
            ModelBaseContext objectContext = null;

            if (Blog.Infrastructure.HttpExtenions.HttpContext.Current.Items.ContainsKey(_dataContextKey))
            {
                objectContext = (ModelBaseContext)Blog.Infrastructure.HttpExtenions.HttpContext.Current.Items[_dataContextKey];
            }

            return(objectContext);
        }
 /// <summary>
 /// 获取缓存上下文
 /// </summary>
 /// <param name="libraryDataContext"></param>
 public void Store(ModelBaseContext libraryDataContext)
 {
     if (Blog.Infrastructure.HttpExtenions.HttpContext.Current.Items.ContainsKey(_dataContextKey))
     {
         Blog.Infrastructure.HttpExtenions.HttpContext.Current.Items[_dataContextKey] = libraryDataContext;
     }
     else
     {
         Blog.Infrastructure.HttpExtenions.HttpContext.Current.Items.Add(_dataContextKey, libraryDataContext);
     }
 }
        /// <summary>
        /// 获取上下文
        /// </summary>
        /// <returns></returns>
        public static ModelBaseContext GetDataContext()
        {
            IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            ModelBaseContext libraryDataContext = _dataContextStorageContainer.GetDataContext();

            if (libraryDataContext == null)
            {
                libraryDataContext = new ModelBaseContext(new DbContextOptions <ModelBaseContext>());
                _dataContextStorageContainer.Store(libraryDataContext);
            }

            return(libraryDataContext);
        }
예제 #6
0
 //private ModelBaseContext _context;
 public SysRoleModuleButtonRepository(ModelBaseContext context) : base(context)
 {
     //_context = context;
 }
예제 #7
0
 //private ModelBaseContext _context;
 public ChildrenRepository(ModelBaseContext context) : base(context)
 {
     //_context = context;
 }
예제 #8
0
 //private ModelBaseContext _context;
 public SysRoleRepository(ModelBaseContext context) : base(context)
 {
     //_context = context;
 }
예제 #9
0
 //private ModelBaseContext _context;
 public SysOperateLogRepository(ModelBaseContext context) : base(context)
 {
     //_context = context;
 }
예제 #10
0
 //private ModelBaseContext _context;
 public MainRepository(ModelBaseContext context) : base(context)
 {
     //_context = context;
 }
예제 #11
0
        //public GaugeRepository(Uow.EFUnitOfWork unitOfWork) :base(unitOfWork)
        //{


        //}
        public GaugeRepository(ModelBaseContext context) : base(context)
        {
        }
예제 #12
0
 //public UserRepository(Uow.EFUnitOfWork unitOfWork) :base(unitOfWork)
 //{
 //}
 public UserRepository(ModelBaseContext context) : base(context)
 {
 }
예제 #13
0
 public BaseRepository(ModelBaseContext context)
 {
     _context = context;
 }
예제 #14
0
 public EFUnitOfWork(ModelBaseContext context)
 {
     _context = context;
 }
예제 #15
0
        //public EnergyRepository(Uow.EFUnitOfWork unitOfWork):base(unitOfWork)
        //{


        //}
        public EnergyRepository(ModelBaseContext context) : base(context)
        {
        }