?官方文檔:單表更新、更新數(shù)據(jù) - SqlSugar 5x - .NET果糖網(wǎng)文章來源:http://www.zghlxwxcb.cn/news/detail-855983.html
泛型類中增加文章來源地址http://www.zghlxwxcb.cn/news/detail-855983.html
//更新單個實體
public async Task<int> Update(TEntity entity)
{
//IgnoreColumns(ignoreAllNullColumns: true):忽略設置為跳過的列
return await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
//批量更新實體
public async Task<int> Update(List<TEntity> list)
{
//此處不需要加.IgnoreColumns(ignoreAllNullColumns: true),增加該操作會導致更新不成功
return await _db.Updateable(list).ExecuteCommandAsync();
}
到了這里,關于【.net core】【sqlsugar】批量更新方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!