BaseRepository 新增备注
This commit is contained in:
parent
412dccf416
commit
4a42969932
@ -131,6 +131,13 @@ namespace ZR.Repository
|
|||||||
return Context.Updateable(entity).UpdateColumns(expression).IgnoreColumns(ignoreAllNull).ExecuteCommand();
|
return Context.Updateable(entity).UpdateColumns(expression).IgnoreColumns(ignoreAllNull).ExecuteCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据实体类更新 eg:Update(dept, it => new { it.Status }, f => depts.Contains(f.DeptId));只更新Status列,条件是包含
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <param name="expression"></param>
|
||||||
|
/// <param name="where"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
||||||
{
|
{
|
||||||
return Context.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand();
|
return Context.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand();
|
||||||
@ -169,6 +176,13 @@ namespace ZR.Repository
|
|||||||
// });
|
// });
|
||||||
// return result.IsSuccess;
|
// return result.IsSuccess;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新指定列 eg:Update(w => w.NoticeId == model.NoticeId, it => new SysNotice(){ Update_time = DateTime.Now, Title = "通知标题" });
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="where"></param>
|
||||||
|
/// <param name="columns"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
|
public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
|
||||||
{
|
{
|
||||||
return Context.Updateable<T>().SetColumns(columns).Where(where).RemoveDataCache().ExecuteCommand();
|
return Context.Updateable<T>().SetColumns(columns).Where(where).RemoveDataCache().ExecuteCommand();
|
||||||
|
|||||||
@ -132,6 +132,13 @@ namespace ZR.Service
|
|||||||
return baseRepository.Update(entity, expression, ignoreAllNull);
|
return baseRepository.Update(entity, expression, ignoreAllNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据实体类更新 eg:Update(dept, it => new { it.Status }, f => depts.Contains(f.DeptId));只更新Status列,条件是包含
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <param name="expression"></param>
|
||||||
|
/// <param name="where"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
||||||
{
|
{
|
||||||
return baseRepository.Update(entity, expression, where);
|
return baseRepository.Update(entity, expression, where);
|
||||||
@ -171,6 +178,13 @@ namespace ZR.Service
|
|||||||
// });
|
// });
|
||||||
// return result.IsSuccess;
|
// return result.IsSuccess;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新指定列 eg:Update(w => w.NoticeId == model.NoticeId, it => new SysNotice(){ Update_time = DateTime.Now, Title = "通知标题" });
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="where"></param>
|
||||||
|
/// <param name="columns"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
|
public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
|
||||||
{
|
{
|
||||||
return baseRepository.Update(where, columns);
|
return baseRepository.Update(where, columns);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user