Beispiel #1
0
        public Task <int> UpdateAsync(List <TEntity> entitys, string[] ignoreColumns = null)
        {
            IUpdateable <TEntity> up = _dbContext.Updateable(entitys);

            if (ignoreColumns != null && ignoreColumns.Length > 0)
            {
                up = up.IgnoreColumns(ignoreColumns);
            }
            return(up.ExecuteCommandAsync());
        }
Beispiel #2
0
        public Task <int> UpdateAsync(Expression <Func <TEntity, TEntity> > update, Expression <Func <TEntity, bool> > predicate = null)
        {
            IUpdateable <TEntity> up = _dbContext.Updateable(update);

            if (predicate != null)
            {
                up = up.Where(predicate);
            }
            return(up.ExecuteCommandAsync());
        }
Beispiel #3
0
        public async Task <int> Update(TEntity model, List <string> columns = null, List <string> ignoreColumn = null, string where = null)
        {
            IUpdateable <TEntity> up = await Task.Run(() => Db.Updateable <TEntity>(model));

            if (columns != null && columns.Count > 0)
            {
                up = await Task.Run(() => up.UpdateColumns(columns.ToArray()));
            }
            if (ignoreColumn != null && ignoreColumn.Count > 0)
            {
                up = await Task.Run(() => up.IgnoreColumns(ignoreColumn.ToArray()));
            }
            if (string.IsNullOrWhiteSpace(where))
            {
                up = await Task.Run(() => up.Where(where));
            }
            return(await up.ExecuteCommandAsync());
        }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public Task <int> ExecuteCommandAsync()
 {
     return(_updateable.ExecuteCommandAsync());
 }