예제 #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));
        }
예제 #3
0
        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));
 }