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); }
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); }
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); }
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); }