-
Notifications
You must be signed in to change notification settings - Fork 313
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dotnet-policy-service agree |
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBulkCopyColumnMapping.cs
Outdated
Show resolved
Hide resolved
|
||
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 from SQL.BulkLoadNonMatchingColumnMapping()
to SQL.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.cs
Show resolved
Hide resolved
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.
@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)