zzzprojects / Dapper-Plus

Dapper Plus - High-Efficient Bulk Actions (Insert, Update, Delete, and Merge) for .NET
https://dapper-plus.net/
383 stars 85 forks source link

BulkActionAsync with UseBulkOptions #91

Closed jakehockey10 closed 3 years ago

jakehockey10 commented 3 years ago

Hello,

I'm currently running a command like this:

connection
      // Want to make sure that we only insert what we don't already have
      .UseBulkOptions(options => options.InsertIfNotExists = true)   
      // Attempt to insert all sensor readings
      .BulkInsert(sensorReadings);

I would like to make this an asynchronous operation. However, I can't figure out how to choose the InsertIfNotExists = true option when using connection.BulkActionAsync(x => ...). UseBulkOptions doesn't seem to be a method I can use any more inside of the Action I pass into BulkActionAsync.

Is there a way to do this with BulkActionAsync? Should I avoid just using Task.Run(() => ...)?

JonathanMagnan commented 3 years ago

Hello @jakehockey10 ,

Thank you for reporting, we indeed seem to miss something here.

We will look at it.

Best Regards,

Jon

JonathanMagnan commented 3 years ago

Hello @jakehockey10 ,

The v4.0.4 has been released.

The BulkActionAsync method can now be chained after the UseBulkOptions method.

Let me know if everything is working as expected.

Best Regards,

Jon

jakehockey10 commented 3 years ago

@JonathanMagnan Thank you so much! I have scheduled an upgrade for our team and I will let you know how that goes. Thank you very much for the prompt response and adjusting the API for us.

JonathanMagnan commented 3 years ago

Awesome @jakehockey10

I will be looking forward to hearing from you!

jakehockey10 commented 3 years ago

@JonathanMagnan we are good to go. I appreciate everything!