Skip to content

Commit b3d4ecc

Browse files
committed
BulkOptions
1 parent 8c63815 commit b3d4ecc

File tree

81 files changed

+1545
-1534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1545
-1534
lines changed

.github/copilot-instructions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## General
2+
3+
* Do not use ```--force``` or ```--legacy-peer-deps``` when running ```npm install``` unless explicitly told.
4+
5+
## C#
6+
7+
* For collection: prefer [ ] instead of new string[] { }

README.md

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -184,33 +184,33 @@ await new BulkInsertBuilder<Row>(connection)
184184
```c#
185185
await _context.BulkInsertAsync(rows,
186186
row => new { row.Column1, row.Column2, row.Column3 },
187-
options =>
187+
new BulkInsertOptions
188188
{
189-
options.KeepIdentity = false;
190-
options.BatchSize = 0;
191-
options.Timeout = 30;
192-
options.LogTo = Console.WriteLine;
189+
KeepIdentity = false,
190+
BatchSize = 0,
191+
Timeout = 30,
192+
LogTo = Console.WriteLine
193193
});
194194
```
195195
### BulkUpdate
196196
```c#
197197
await _context.BulkUpdateAsync(rows,
198198
row => new { row.Column3, row.Column2 },
199-
options =>
199+
new BulkUpdateOptions
200200
{
201-
options.BatchSize = 0;
202-
options.Timeout = 30;
203-
options.LogTo = Console.WriteLine;
201+
BatchSize = 0,
202+
Timeout = 30,
203+
LogTo = Console.WriteLine
204204
});
205205
```
206206
### BulkDelete
207207
```c#
208208
await _context.BulkDeleteAsync(rows,
209-
options =>
209+
new BulkDeleteOptions
210210
{
211-
options.BatchSize = 0;
212-
options.Timeout = 30;
213-
options.LogTo = Console.WriteLine;
211+
BatchSize = 0,
212+
Timeout = 30,
213+
LogTo = Console.WriteLine
214214
});
215215
```
216216
### BulkMerge
@@ -219,24 +219,23 @@ await _context.BulkMergeAsync(rows,
219219
row => row.Id,
220220
row => new { row.Column1, row.Column2 },
221221
row => new { row.Column1, row.Column2, row.Column3 },
222-
options =>
222+
new BulkMergeOptions
223223
{
224-
options.BatchSize = 0;
225-
options.Timeout = 30;
226-
options.WithHoldLock = false;
227-
options.ReturnDbGeneratedId = true;
228-
options.LogTo = Console.WriteLine;
224+
BatchSize = 0,
225+
Timeout = 30,
226+
ReturnDbGeneratedId = true,
227+
LogTo = Console.WriteLine
229228
});
230229
```
231230
### BulkMatch
232231
```c#
233232
var contactsFromDb = await _context.BulkMatchAsync(matchedContacts,
234233
x => new { x.CustomerId, x.CountryIsoCode },
235-
options =>
234+
new BulkMatchOptions
236235
{
237-
options.BatchSize = 0;
238-
options.Timeout = 30;
239-
options.LogTo = Console.WriteLine;
236+
BatchSize = 0,
237+
Timeout = 30,
238+
LogTo = Console.WriteLine
240239
});
241240
```
242241
### TempTable
@@ -249,40 +248,40 @@ var customerTableName = await _context.CreateTempTableAsync(customers,
249248
x.LastName,
250249
x.CurrentCountryIsoCode
251250
},
252-
options =>
251+
new TempTableOptions
253252
{
254-
options.BatchSize = 0;
255-
options.Timeout = 30;
256-
options.LogTo = Console.WriteLine;
253+
BatchSize = 0,
254+
Timeout = 30,
255+
LogTo = Console.WriteLine
257256
});
258257
```
259258
### DirectInsert
260259
```c#
261260
await _context.DirectInsertAsync(row,
262261
row => new { row.Column1, row.Column2, row.Column3 },
263-
options =>
262+
new BulkInsertOptions
264263
{
265-
options.Timeout = 30;
266-
options.LogTo = Console.WriteLine;
264+
Timeout = 30,
265+
LogTo = Console.WriteLine
267266
});
268267
```
269268
### DirectUpdate
270269
```c#
271270
await _context.DirectUpdateAsync(row,
272271
row => new { row.Column3, row.Column2 },
273-
options =>
272+
new BulkUpdateOptions
274273
{
275-
options.Timeout = 30;
276-
options.LogTo = Console.WriteLine;
274+
Timeout = 30,
275+
LogTo = Console.WriteLine
277276
});
278277
```
279278
### DirectDelete
280279
```c#
281280
await _context.DirectDeleteAsync(row,
282-
options =>
281+
new BulkDeleteOptions
283282
{
284-
options.Timeout = 30;
285-
options.LogTo = Console.WriteLine;
283+
Timeout = 30,
284+
LogTo = Console.WriteLine
286285
});
287286
```
288287

src/EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks/BulkDeleteBenchmarks.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using BenchmarkDotNet.Attributes;
22
using EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks.Database;
3-
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkInsert;
43
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkDelete;
4+
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkInsert;
55
using Microsoft.EntityFrameworkCore;
66

77
namespace EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks;
@@ -65,9 +65,9 @@ public void EFCoreDelete()
6565
public void BulkDelete()
6666
{
6767
_context.BulkDelete(_customersToDelete,
68-
opt =>
68+
new BulkDeleteOptions()
6969
{
70-
opt.Timeout = 0;
70+
Timeout = 0
7171
});
7272
}
7373
}
@@ -123,9 +123,9 @@ public void IterationCleanup()
123123
public void BulkDelete()
124124
{
125125
_context.BulkDelete(_customersToDelete,
126-
opt =>
126+
new BulkDeleteOptions()
127127
{
128-
opt.Timeout = 0;
128+
Timeout = 0
129129
});
130130
}
131131
}

src/EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks/BulkInsertMultipleTablesBenchmarks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public void EFCoreInsert()
6868
[Benchmark]
6969
public void BulkInsert()
7070
{
71-
_context.BulkInsert(_customers, opt =>
71+
_context.BulkInsert(_customers, new BulkInsertOptions()
7272
{
73-
opt.Timeout = 0;
73+
Timeout = 0
7474
});
7575

7676
foreach (var customer in _customers)
@@ -81,9 +81,9 @@ public void BulkInsert()
8181
}
8282
}
8383

84-
_context.BulkInsert(_contacts, opt =>
84+
_context.BulkInsert(_contacts, new BulkInsertOptions()
8585
{
86-
opt.Timeout = 0;
86+
Timeout = 0
8787
});
8888
}
8989
}

src/EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks/BulkInsertSingleTableBenchmarks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public void EFCoreInsert()
5252
[Benchmark]
5353
public void BulkInsert()
5454
{
55-
_context.BulkInsert(_customers, opt =>
55+
_context.BulkInsert(_customers, new BulkInsertOptions()
5656
{
57-
opt.Timeout = 0;
57+
Timeout = 0
5858
});
5959
}
6060
}

src/EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks/BulkMatchMultipleColumnsBenchmarks.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public void GlobalSetup()
5959
}
6060

6161
_context.BulkInsert(_customers,
62-
opt =>
62+
new BulkInsertOptions()
6363
{
64-
opt.Timeout = 0;
64+
Timeout = 0
6565
});
6666

6767
foreach (var customer in _customers)
@@ -75,9 +75,9 @@ public void GlobalSetup()
7575
_contacts = _customers.SelectMany(x => x.Contacts).ToList();
7676

7777
_context.BulkInsert(_contacts,
78-
opt =>
78+
new BulkInsertOptions()
7979
{
80-
opt.Timeout = 0;
80+
Timeout = 0
8181
});
8282

8383
_contactsToMatch = _customers.Select(x => new Contact { CustomerId = x.Id, CountryIsoCode = x.CurrentCountryIsoCode }).ToList();
@@ -107,9 +107,9 @@ public void BulkMatch()
107107
{
108108
var contacts = _context.BulkMatch(_contactsToMatch,
109109
x => new { x.CustomerId, x.CountryIsoCode },
110-
opt =>
110+
new BulkMatchOptions()
111111
{
112-
opt.Timeout = 0;
112+
Timeout = 0
113113
});
114114

115115
// Console.WriteLine(contacts.Count);
@@ -169,9 +169,9 @@ public void GlobalSetup()
169169
}
170170

171171
_context.BulkInsert(_customers,
172-
opt =>
172+
new BulkInsertOptions()
173173
{
174-
opt.Timeout = 0;
174+
Timeout = 0
175175
});
176176

177177
foreach (var customer in _customers)
@@ -185,9 +185,9 @@ public void GlobalSetup()
185185
_contacts = _customers.SelectMany(x => x.Contacts).ToList();
186186

187187
_context.BulkInsert(_contacts,
188-
opt =>
188+
new BulkInsertOptions()
189189
{
190-
opt.Timeout = 0;
190+
Timeout = 0
191191
});
192192

193193
_contactsToMatch = _customers.Select(x => new Contact { CustomerId = x.Id, CountryIsoCode = x.CurrentCountryIsoCode }).ToList();
@@ -204,9 +204,9 @@ public void BulkMatch()
204204
{
205205
var contacts = _context.BulkMatch(_contactsToMatch,
206206
x => new { x.CustomerId, x.CountryIsoCode },
207-
opt =>
207+
new BulkMatchOptions()
208208
{
209-
opt.Timeout = 0;
209+
Timeout = 0
210210
});
211211

212212
// Console.WriteLine(contacts.Count);

src/EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks/BulkMatchSingleColumnBenchmarks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ public void BulkMatch()
8686

8787
var customers = _context.BulkMatch(matchedCustomers,
8888
x => x.Id,
89-
opt =>
89+
new BulkMatchOptions()
9090
{
91-
opt.Timeout = 0;
91+
Timeout = 0
9292
});
9393
}
9494
}
@@ -162,9 +162,9 @@ public void BulkMatch()
162162

163163
var customers = _context.BulkMatch(matchedCustomers,
164164
x => x.Id,
165-
opt =>
165+
new BulkMatchOptions()
166166
{
167-
opt.Timeout = 0;
167+
Timeout = 0
168168
});
169169
}
170170
}

src/EntityFrameworkCore.SqlServer.SimpleBulks.Benchmarks/BulkMergeBenchmarks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ public void BulkMerge()
105105
x => x.Id,
106106
x => new { x.FirstName },
107107
x => new { x.FirstName, x.LastName, x.Index },
108-
opt =>
108+
new BulkMergeOptions()
109109
{
110-
opt.Timeout = 0;
110+
Timeout = 0
111111
});
112112
}
113113
}

0 commit comments

Comments
 (0)