Пример #1
0
        public void DeleteAsync <TEntity>(Expression <Func <TEntity, bool> > filter) where TEntity : class
        {
            SqlStatement = filter.ToString();
            switch (DataBaseType)
            {
            case DataBaseType.MongoDB:
                GetCollectionEntity <TEntity>().DeleteManyAsync(filter);
                break;

            default:
                break;
            }
            DbCacheManager.Delete(this, filter);
        }
Пример #2
0
        public override async Task <int> DeleteAsync <TEntity>(TEntity 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.Delete(entity);
            this.TableName = GetTableName <TEntity>();

            this.DBTransaction.SyncCommandTransaction();

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

            DbCacheManager.Delete(entity);
            return(res);
        }
Пример #3
0
        public override int Delete <TEntity>(Expression <Func <TEntity, bool> > filter)
        {
            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.Delete(filter);
            this.TableName = GetTableName <TEntity>();

            this.DBTransaction.SyncCommandTransaction();

            int res = this.QueryExecutor.ExecuteNonQuery(this);

            DbCacheManager.Delete(filter);
            return(res);
        }
Пример #4
0
 public void DeleteAsync <TEntity>(Expression <Func <TEntity, bool> > filter) where TEntity : class
 {
     SqlGenerator.Delete(this, filter);
     DbHelper.ExecuteNonQueryAsync(SqlStatement);
     DbCacheManager.Delete(this, filter);
 }
Пример #5
0
        public override async Task DeleteAsync <TEntity>(Expression <Func <TEntity, bool> > filter)
        {
            await GetCollectionEntity <TEntity>().DeleteManyAsync(filter);

            DbCacheManager.Delete(filter);
        }
Пример #6
0
 public override void Delete <TEntity>(Expression <Func <TEntity, bool> > filter)
 {
     GetCollectionEntity <TEntity>().DeleteMany(filter);
     DbCacheManager.Delete(filter);
 }
Пример #7
0
        public async Task DeleteOneAsync <TEntity>(Expression <Func <TEntity, bool> > filter) where TEntity : class
        {
            await GetCollectionEntity <TEntity>().DeleteOneAsync(filter);

            DbCacheManager.Delete(filter);
        }
Пример #8
0
 public void DeleteOne <TEntity>(Expression <Func <TEntity, bool> > filter) where TEntity : class
 {
     GetCollectionEntity <TEntity>().DeleteOne(filter);
     DbCacheManager.Delete(filter);
 }