Exemplo 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);
        }
Exemplo n.º 2
0
        public void UpdateAsync <TEntity>(Expression <Func <TEntity, bool> > filter, TEntity entity) where TEntity : class
        {
            SqlStatement = filter.ToString();
            switch (DataBaseType)
            {
            case DataBaseType.MongoDB:
                GetCollectionEntity <TEntity>().ReplaceOneAsync(filter, entity);
                break;

            default:
                break;
            }
            DbCacheManager.Update(this, entity, filter);
        }
Exemplo n.º 3
0
        public override async Task <int> UpdateAsync <TEntity>(TEntity entity)
        {
            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.Update(entity, out filter);
            this.TableName = GetTableName <TEntity>();

            this.DBTransaction.SyncCommandTransaction();

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

            DbCacheManager.Update(entity, filter);
            return(res);
        }
Exemplo n.º 4
0
 public void UpdateAsync <TEntity>(Expression <Func <TEntity, bool> > filter, TEntity entity) where TEntity : class
 {
     SqlGenerator.Update(this, filter, entity, out Dictionary <string, object> paramsDic);
     DbHelper.ExecuteNonQueryAsync(SqlStatement, System.Data.CommandType.Text, paramsDic);
     DbCacheManager.Update(this, entity, filter);
 }