public async Task <int> UpdateAsync(T entity) { SqlProvider.FormatUpdate(entity); SetSql(); var result = await ExecAsync(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction); return(result); }
public int Update(IEnumerable <T> entities, string[] excludeFields = null, int timeout = 120) { SqlProvider.FormatUpdate(entities.FirstOrDefault(), excludeFields, true); //批量修改不需要别名(暂时有点小bug,先勉强使用下) SqlProvider.SqlString = SqlProvider.SqlString.Replace("Update_", "").Replace("_0", "").Replace("_1", ""); var identity = EntityCache.QueryEntity(typeof(T)).Identitys; SqlProvider.SqlString += $" AND {identity}={SqlProvider.ProviderOption.ParameterPrefix + identity}"; return(DbCon.Execute(SqlProvider.SqlString, entities, DbTransaction, timeout)); }
public async Task <int> UpdateAsync(IEnumerable <T> entities, string[] excludeFields = null, int timeout = 120) { SqlProvider.FormatUpdate(entities.FirstOrDefault(), excludeFields, true); //批量修改不需要别名(暂时有点小bug,先勉强使用下) SqlProvider.SqlString = SqlProvider.SqlString.Replace("Update_", "").Replace("_0", "").Replace("_1", ""); var identity = EntityCache.QueryEntity(typeof(T)).Identitys; SqlProvider.SqlString += $" AND {SqlProvider.ProviderOption.CombineFieldName(identity)}={SqlProvider.ProviderOption.ParameterPrefix + identity}"; return(await DbCon.ExecuteAsync(SqlProvider.SqlString, entities, DbTransaction, timeout, isExcludeUnitOfWork : SqlProvider.IsExcludeUnitOfWork)); }
public int Update(T entity, string[] excludeFields = null) { SqlProvider.FormatUpdate(entity, excludeFields); return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }
public int Update(T entity) { SqlProvider.FormatUpdate(a => entity); return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction)); }
public async Task <int> UpdateAsync(Expression <Func <T, T> > updateExpression) { SqlProvider.FormatUpdate(updateExpression); return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }
public int Update(Expression <Func <T, T> > updateExpression) { SqlProvider.FormatUpdate(updateExpression); return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }
public async Task <int> UpdateAsync(T entity) { SqlProvider.FormatUpdate(entity); return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }
public int Update(T entity) { SqlProvider.FormatUpdate(entity); SetSql(); return(Exec(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction)); }
public async Task <int> UpdateAsync(T entity, string[] excludeFields = null, int timeout = 120) { SqlProvider.FormatUpdate(entity, null); return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction, isExcludeUnitOfWork : SqlProvider.IsExcludeUnitOfWork)); }
public int Update(T entity, string[] excludeFields = null, int timeout = 120) { SqlProvider.FormatUpdate(entity, excludeFields); return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, DbTransaction, timeout, isExcludeUnitOfWork: SqlProvider.IsExcludeUnitOfWork)); }