Exemplo n.º 1
0
        public TEntity Update <TEntity>(TEntity entity) where TEntity : class
        {
            DbWriteContext.Set <TEntity>().Attach(entity);
            var table = DbWriteContext.Entry(entity);

            table.State = EntityState.Modified;
            return(table.Entity);
        }
Exemplo n.º 2
0
        public Repository(DbReadContext readContext, DbWriteContext writeContext)
        {
            this.readContext = readContext;
            this.readContext.Configuration.LazyLoadingEnabled       = false;
            this.readContext.Configuration.AutoDetectChangesEnabled = false;

            this.writeContext = writeContext;
        }
Exemplo n.º 3
0
 public void Commit(bool Candispose = true)
 {
     try
     {
         DbWriteContext.SaveChanges();
     }
     catch (Exception ex)
     {
     }
     finally
     {
         if (Candispose)
         {
             DbWriteContext.Dispose();
         }
     }
 }
Exemplo n.º 4
0
 public QuotationRepository(DbReadContext readContext, DbWriteContext writeContext) : base(readContext, writeContext)
 {
 }
Exemplo n.º 5
0
 public UserRepository(DbReadContext readContext, DbWriteContext writeContext) : base(readContext, writeContext)
 {
 }
Exemplo n.º 6
0
 public IQueryable <TEntity> DeleteRange <TEntity>(IEnumerable <TEntity> entity) where TEntity : class
 {
     return(DbWriteContext.Set <TEntity>().RemoveRange(entity).AsQueryable());
 }
Exemplo n.º 7
0
 public TEntity Delete <TEntity>(TEntity entity) where TEntity : class
 {
     return(DbWriteContext.Set <TEntity>().Remove(entity));
 }
Exemplo n.º 8
0
 public TEntity Add <TEntity>(TEntity entity) where TEntity : class
 {
     return(DbWriteContext.Set <TEntity>().Add(entity));
 }