zzzprojects/Dapper-Plus

How to pass cancellation token to BulkSynchronize?

VictorioBerra opened this issue · 2 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: info@zzzprojects.com

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:

Hello @VictorioBerra ,

Thank you for reporting.

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

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