Skip to content

Commit 9983ebb

Browse files
authored
EFCore 3 docs update
1 parent 49920ca commit 9983ebb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
EntityFrameworkCore extensions: Bulk operations (**Insert, Update, Delete, Read, Upsert, Sync**) and Batch (**Delete, Update**).<br>
33
Library is Lightweight and very Efficient, having all mostly used CRUD operation.<br>
44
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>
78
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>
89
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>
910
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();
4344

4445
// Update (using Expression arg.) supports Increment/Decrement
4546
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);
4753

4854
// Update (via simple object)
4955
context.Items.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });

0 commit comments

Comments
 (0)