示例#1
0
        public async Task <int> UpdateAsync(T entity)
        {
            SqlProvider.FormatUpdate(entity);
            SetSql();
            var result = await ExecAsync(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction);

            return(result);
        }
示例#2
0
        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));
        }
示例#4
0
 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));
        }
示例#6
0
        public async Task <int> UpdateAsync(Expression <Func <T, T> > updateExpression)
        {
            SqlProvider.FormatUpdate(updateExpression);

            return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction));
        }
示例#7
0
        public int Update(Expression <Func <T, T> > updateExpression)
        {
            SqlProvider.FormatUpdate(updateExpression);

            return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, DbTransaction));
        }
示例#8
0
        public async Task <int> UpdateAsync(T entity)
        {
            SqlProvider.FormatUpdate(entity);

            return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction));
        }
示例#9
0
 public int Update(T entity)
 {
     SqlProvider.FormatUpdate(entity);
     SetSql();
     return(Exec(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction));
 }
示例#10
0
 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));
 }
示例#11
0
 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));
 }