jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
861 stars 145 forks source link

Overrode BulkCopyAsync in DbConnectionWrapperInsightDbProvider #396

Closed Greeng0 closed 5 years ago

Greeng0 commented 5 years ago

Description

Closes #397 Functionality was missing for taking the DbConnectionWrapper's transaction when an IDbTransaction was not provided to the BulkCopyAsync extension method. This caused a exception to be thrown (Unexpected existing transaction: https://stackoverflow.com/questions/19117106/sqlbulkcopy-unexpected-existing-transaction).

The logic was there for the non-async BulkCopy, so I just created a similar override for BulkCopyAsync,

Checklist

Please make sure your pull request fulfills the following requirements:

Type

This pull request includes what type of changes?

Breaking Changes

Does this pull request introduce any breaking changes?

Any other comment

I didn't modify any tests as I couldn't even get them to run, but the test case to reproduce the issue here would simply involve using a DbConnectionWrapper and invoking BeginAutoTransaction on it before the BulkCopyAsync.