Dapper-Plus icon indicating copy to clipboard operation
Dapper-Plus copied to clipboard

How to pass cancellation token to BulkSynchronize?

Open VictorioBerra opened this issue 1 year ago • 1 comments

Description

Describe the issue or proposed feature.

Allow .BulkSynchronize() to accept a cancellation token

Exception

If you are seeing an exception, include the full exceptions details (message and stack trace).

Exception message:
Stack trace:

Fiddle or Project (Optional)

If you are able,

Provide a Fiddle that reproduces the issue: https://dotnetfiddle.net/kV5RHX

Or provide a project/solution that we can run to reproduce the issue.

  • Make sure the project compile
  • Make sure to provide only the code that is required to reproduce the issue, not the whole project
  • You can send private code here: [email protected]

Otherwise, make sure to include as much information as possible to help our team to reproduce the issue.

Note: More information you provide, faster we can implement a solution.

Further technical details

  • Dapper version:
  • Dapper Plus version:
  • Database Provider:

VictorioBerra avatar Sep 14 '22 17:09 VictorioBerra

Hello @VictorioBerra ,

Thank you for reporting.

I will discuss about it with my developer as using the BulkActionAsync is really not obvious.

JonathanMagnan avatar Sep 14 '22 19:09 JonathanMagnan

Hello @VictorioBerra ,

Sorry for the long waiting. I just noticed I forgot to give you an example with the BulkActionAsync

Unfortunately, we could not agree on how to add async method to bulk operations such as BulkSynchronize due to how chaining action currently work in Dapper Plus.

Currently, using Async could only be done with the BulkActionAsync.

Here is an example with a cancellation token:

var task = connection.BulkActionAsync(x => x.BulkInsert(invoices).ThenBulkInsert(y => y.InvoiceItems), cancellationToken);

Doc: https://dapper-plus.net/async-action

Best Regards,

Jon

JonathanMagnan avatar Oct 26 '22 14:10 JonathanMagnan