Esempio n. 1
0
        public override async Task UpdateAsync <TEntity>(Expression <Func <TEntity, bool> > filter, TEntity entity)
        {
            PropertyDataValidator.Verify(this, entity);
            await GetCollectionEntity <TEntity>().ReplaceOneAsync(filter, entity);

            DbCacheManager.Update(entity, filter);
        }
Esempio n. 2
0
        public async Task AddAsync <TEntity>(IEnumerable <TEntity> entities) where TEntity : class
        {
            PropertyDataValidator.Verify(this, entities);
            await GetCollectionEntity <TEntity>().InsertManyAsync(entities);

            DbCacheManager.Add(entities);
        }
Esempio n. 3
0
        public override async Task AddAsync <TEntity>(TEntity entity)
        {
            PropertyDataValidator.Verify(this, entity);
            await GetCollectionEntity <TEntity>().InsertOneAsync(entity);

            DbCacheManager.Add(entity);
        }
Esempio n. 4
0
        public override async Task <int> AddAsync <TEntity>(TEntity entity)
        {
            PropertyDataValidator.Verify <TEntity>(this, entity);

            this.Parameters.Clear();
            this.ConnectionManager.SetConnectionString(OperationType.Write);
            this.DbConnection          = this.GetDbConnection(this.ConnectionManager.CurrentConnectionString);
            this.DbCommand.Connection  = this.DbConnection;
            this.DbCommand.CommandType = CommandType.Text;
            this.CommandTextGenerator.Add(entity);
            this.TableName = GetTableName <TEntity>();

            this.DBTransaction.SyncCommandTransaction();

            int res = await this.QueryExecutor.ExecuteNonQueryAsync(this);

            DbCacheManager.Add(entity);
            return(res);
        }
Esempio n. 5
0
 public override void Add <TEntity>(TEntity entity)
 {
     PropertyDataValidator.Verify(this, entity);
     GetCollectionEntity <TEntity>().InsertOne(entity);
     DbCacheManager.Add(entity);
 }
Esempio n. 6
0
 public void Add <TEntity>(IEnumerable <TEntity> entities) where TEntity : class
 {
     PropertyDataValidator.Verify(this, entities);
     GetCollectionEntity <TEntity>().InsertMany(entities);
     DbCacheManager.Add(entities);
 }