Support. NET6! Zack.EFCore.Batch is a framework for batch updating, deleting, and inserting data in EF Core

Support. NET6! Zack.EFCore.Batch is a framework for batch updating, deleting, and inserting data in EF Core

A new version of the framework 'Zack.EFCore.Batch' that performs 'updates','deletes', and 'inserts' of data in 'EF Core' has been released. The new version adds support for '. NET 6' and supports 'ValueConverter' when data is inserted in batches, completely solving the 'The count of columns should be even exception that occurs when the expressions of two columns are equivalent' when updating data.

最后更新 12/25/2021 7:23 PM
杨中科
预计阅读 2 分钟
分类
EF Core
标签
.NET C# EF Core ORM bulk inserts

我开发的在EF Core批量执行更新删除插入数据的框架Zack.EFCore.Batch已经发布新版,新版增加了对.NET 6的支持,数据批量插入的时候支持ValueConverter,彻底解决了“更新数据的时候,当两列的表达式等价时候出现的The count of columns should be even异常”

At present, the project has more than 200 stars and has solved more than 40 issues, so it is relatively mature.

Using this library, we can update and delete data in batches in the following ways:

await ctx.DeleteRangeAsync<Book>(b => b.Price > n || b.AuthorName == "zack yang");

await ctx.BatchUpdate<Book>()
    .Set(b => b.Price, b => b.Price + 3)
    .Set(b => b.Title, b => s)
    .Set(b => b.AuthorName,b=>b.Title.Substring(3,2)+b.AuthorName.ToUpper())
    .Set(b => b.PubTime, DateTime.Now)
    .Where(b => b.Id > n || b.AuthorName.StartsWith("Zack"))
    .ExecuteAsync();

Zack.EFCore.Batch支持数据的批量快速插入

当然,如果您使用SqlSugarDapper之类的ORM也可以实现类似的效果,我这个库最大的特色就是它是基于EF Core的扩展,可以复用EF Core的特性。如果您不使用EF Core,那么可以忽略它。

Original author: Yang Zhongke

Original link: mp.weixin.qq.com/s/MYxVGxa_DQnn4XMIDryd9Q

Project address: github.com/yangzhongke/Zack.EFCore.Batch

Keep Exploring

延伸阅读

更多文章