- Notifications
You must be signed in to change notification settings - Fork311
SqlBulkCopy: Explicitly state column name that mismatches(#3170)#3183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@dotnet-policy-service agree |
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBulkCopyColumnMapping.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
if(!columnMapping._matchedOrRejected) | ||
{ | ||
throw (SQL.BulkLoadNonMatchingColumnName(columnMapping.SourceColumn)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Does changing fromSQL.BulkLoadNonMatchingColumnMapping()
toSQL.BulkLoadNonMatchingColumnName()
affect our API promises? They both end up throwing InvalidOperationException, so probably not. Callers shouldn't be depending on the message of the exception, but you never know!
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/MissingTargetColumn.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great idea overall, with a few improvements noted.
509e7b8
intodotnet:mainUh oh!
There was an error while loading.Please reload this page.
@JNjenga - Thanks for the changes! |
Throwing
SQL.BulkLoadNonMatchingColumnMapping
exception when column mappings mismatch does not provide enough information about where the error occurred. ThrowingSQL.BulkLoadNonMatchingColumnName
exception is more appropriate.Fixes (#3170)