public UserService(ModelManagementContext context = null) : base(context) { var appContext = context ?? new ModelManagementContext(); _appRepository = new AppRepository(appContext); _mapper = new ObjectMapper(); }
public UnitOfWork() { if (this.dbContext == null) { this.dbContext = new ModelManagementContext(); } }
public CategoryService(ModelManagementContext context = null) : base(context) { //_context = context ?? new ModelManagementContext(); //_categotyRepo = new EntityRepository<Category>(context); var appContext = context ?? new ModelManagementContext(); _appRepository = new AppRepository(appContext); }
public ContentService(ModelManagementContext context = null) : base(context) { var appContext = context ?? new ModelManagementContext(); _appRepository = new AppRepository(appContext); //_uplodableRepository = new EntityRepository<Uploadable>(_context); _mapper = new ObjectMapper(); }
public CommonDataService(ModelManagementContext context = null) : base(context) { var appContext = context ?? new ModelManagementContext(); _appRepository = new AppRepository(appContext); _geoTypeRepository = new EntityRepository <GeoType>(_context); _geoRepository = new EntityRepository <Geo>(_context); _geoAssocRepository = new EntityRepository <GeoAssoc>(_context); //_appRepository = new AppRepository(_context); //Context = context; }
private void Dispose(bool disposing) { if (!disposing) { return; } if (dbContext == null) { return; } dbContext.Dispose(); dbContext = null; }
public virtual TEntity Create(TEntity TObject) { using (var context = new ModelManagementContext()) { using (var dbTransaction = context.Database.BeginTransaction()) { try { TEntity newE = context.Set <TEntity>().Add(TObject); context.SaveChanges(); dbTransaction.Commit(); return(newE); } catch (Exception exception) { dbTransaction.Rollback(); throw exception; } } } //using (var dbTransaction = uow.DbContext.Database.BeginTransaction()) //{ // try // { // TEntity newEntity = DbSet.Add(TObject); // if (!shareContext) // { // if (uow.SaveChanges() > 0) // { // dbTransaction.Commit(); // return newEntity; // } // } // } // catch (Exception exception) // { // dbTransaction.Rollback(); // uow = new UnitOfWork(); // throw exception; // } //} //TEntity newEntity = DbSet.Add(TObject); //if (!shareContext) //{ // if (uow.SaveChanges() > 0) // { // return newEntity; // } //} }
//public virtual bool Update(TEntity TObject) //{ // var entry = uow.DbContext.Entry(TObject); // DbSet.Attach(TObject); // entry.State = EntityState.Modified; // if (!shareContext) // return uow.SaveChanges() >= 0; // return false; //} public virtual TEntity Update(TEntity TObject) { TObject.LastUpdatedStamp = DateTime.Now; ModelManagementContext context = uow.DbContext; var entry = uow.DbContext.Entry(TObject); TEntity newEntity = DbSet.Attach(TObject); entry.State = EntityState.Modified; if (!shareContext) { if (uow.SaveChanges() >= 0) { context.Entry(TObject).State = EntityState.Detached; return(newEntity); } } return(null); }
public ModelManagementQuery(ModelManagementContext context) { this._context = context; }
public ModelManagementQueryServices() { _context = new ModelManagementContext(); _query = new ModelManagementQuery(this._context); }
public void TestMethod1() { _context = new ModelManagementContext(); _context.Database.Delete(); _context.Database.CreateIfNotExists(); }
public ContactService(ModelManagementContext context = null) : base(context) { var appContext = context ?? new ModelManagementContext(); _appRepository = new AppRepository(appContext); }
public EntityRepository() { this._context = new ModelManagementContext(); }
public TransactionScope() { Context = new ModelManagementContext(); _dbTransaction = Context.Database.BeginTransaction(); }
public AppRepository(ModelManagementContext context = null) { Context = context ?? new ModelManagementContext(); }
public UnitOfWork(ModelManagementContext dbContext) { this.dbContext = dbContext; }
public EntityRepository(ModelManagementContext context) { this._context = context; }
public Class1(ModelManagementContext context) { Context = context; }
public ModelManagementApiService() { _context = new ModelManagementContext(); }
public CommonDataQuery(ModelManagementContext context) { _context = context; }