public static JamimDataContext GetDataContext() { IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer(); JamimDataContext jamimDataContext = _dataContextStorageContainer.GetDataContext(); if (jamimDataContext == null) { jamimDataContext = new JamimDataContext(); _dataContextStorageContainer.Store(jamimDataContext); } return(jamimDataContext); }
public static LibraryDataContext GetCurrentDataContext() { IDataContextStorageContainer storageContainer = DataContextStorageFactory.GetStorageContainer(); LibraryDataContext dataContext = storageContainer.GetDataContext(); if (dataContext == null) { dataContext = new LibraryDataContext(); storageContainer.Store(dataContext); } return(dataContext); }
public static LibraryDataContext GetDataContext() { IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer(); LibraryDataContext libraryDataContext = _dataContextStorageContainer.GetDataContext(); if (libraryDataContext == null) { libraryDataContext = new LibraryDataContext(); _dataContextStorageContainer.Store(libraryDataContext); } return(libraryDataContext); }
/// <summary> /// Retrieves an instance of EssContext from the appropriate storage container or /// creates a new instance and stores that in a container. /// </summary> /// <returns>An instance of EssContext.</returns> public static MainDataContext GetDataContext() { IDataContextStorageContainer <MainDataContext> dataContextStorageContainer = DataContextStorageFactory <MainDataContext> .CreateStorageContainer(); MainDataContext context = dataContextStorageContainer.GetDataContext(); if (context == null) { context = new MainDataContext(); dataContextStorageContainer.Store(context); } return(context); }
/// <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); }
public static HiDataContext GetDataContext() { IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer(); HiDataContext dataContext = _dataContextStorageContainer.GetDataContext(); if (dataContext == null) { dataContext = new HiDataContext(); _dataContextStorageContainer.Store(dataContext); } return(dataContext); }
public static DbContext GetDataContext <T>() where T : DbContext, new() { IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer(); DbContext dataContext = _dataContextStorageContainer.GetDataContext(); if (dataContext == null) { dataContext = new T(); _dataContextStorageContainer.Store(dataContext); } return(dataContext); }
public static HXContext GetDataContext() { IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer(); HXContext hxContext = _dataContextStorageContainer.GetDataContext(); if (hxContext == null) { hxContext = new HXContext(); } else { hxContext = new HXContext(); _dataContextStorageContainer.Store(hxContext); } return(hxContext); }
public static LibraryDataContext GetDataContext() { //由工厂方法获取贮藏存储对象 IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer(); //由于贮藏存储对象实现了指定接口,即实现了GetDataContext方法,调用该方法获取上下文对象 LibraryDataContext libraryDataContext = _dataContextStorageContainer.GetDataContext(); if (libraryDataContext == null) { libraryDataContext = new LibraryDataContext(); _dataContextStorageContainer.Store(libraryDataContext); } return(libraryDataContext); }