|
2 | 2 | EntityFrameworkCore extensions: Bulk operations (**Insert, Update, Delete, Read, Upsert, Sync**) and Batch (**Delete, Update**).<br>
|
3 | 3 | Library is Lightweight and very Efficient, having all mostly used CRUD operation.<br>
|
4 | 4 | Was selected in top 20 [EF Core Extensions](https://docs.microsoft.com/en-us/ef/core/extensions/) recommended by Microsoft.<br>
|
5 |
| -It is targeting NetStandard 2.0 so it can be used on project targeting NetCore(2.0+) or NetFramework(4.6.1+).<br> |
6 |
| -Current version is using EF Core 2.2 and at the moment supports Microsoft SQL Server(2008+) and SQLite.<br> |
| 5 | +It is targeting NetStandard 2.1 so it can be used on project targeting NetCore(3.0+).<br> |
| 6 | +Current version is using EF Core 3 and at the moment supports Microsoft SQL Server(2008+) and SQLite.<br> |
| 7 | +Versions before 3.0, last being 2.6.3, are targeting NetStandard 2.0 and can be used with NetCore(2.0+) or NetFramework(4.6.1+).<br> |
7 | 8 | EFCore/v.Nuget: EFCore2.1/v2.4.1 EFCore2.0/v2.0.8, and for EF Core 1.x use 1.1.0 (targeting NetStandard 1.4)<br>
|
8 | 9 | Under the hood uses [SqlBulkCopy](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx) for Insert, for Update/Delete combines BulkInsert with raw Sql [MERGE](https://docs.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql).<br>
|
9 | 10 | For SQLite there is no BulkCopy, instead library uses plain SQL combined with [UPSERT](https://www.sqlite.org/lang_UPSERT.html).<br>
|
@@ -43,7 +44,12 @@ context.Items.Where(a => a.ItemId > 500).BatchDeleteAsync();
|
43 | 44 |
|
44 | 45 | // Update (using Expression arg.) supports Increment/Decrement
|
45 | 46 | context.Items.Where(a => a.ItemId <= 500).BatchUpdate(a => new Item { Quantity = a.Quantity + 100 });
|
46 |
| - // can be as value '+100' or as variable '+incrementStep'(int incrementStep = 100;) |
| 47 | + // can be as value '+100' or as variable '+incrementStep' (int incrementStep = 100;) |
| 48 | +// IMPORTANT: When using parameterized Query BatchOperation currently requires argument 'parametersDict' |
| 49 | +int itemId = 500; |
| 50 | +var parametersDict = new Dictionary<string, object> { { nameof(itemId), itemId } }; |
| 51 | +var query = context.Items.Where(a => a.ItemId <= itemId); |
| 52 | +query.BatchUpdate(a => new Item { Quantity = a.Quantity + 100 }, parametersDict); |
47 | 53 |
|
48 | 54 | // Update (via simple object)
|
49 | 55 | context.Items.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });
|
|
0 commit comments