Repository navigation
Map object-typed columns to primitive members again (sql_variant to bool) - #2244
Open
Arthur031221 wants to merge 1 commit into
Open
Arthur031221 wants to merge 1 commit into
Arthur031221 wants to merge 1 commit into
Conversation
…ool) A column reported as plain object keeps the direct unbox only when the target is itself TypeCode.Object. Primitive and string targets use the flexible convert path, as before the DateOnly/TimeOnly change.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Columns that a provider reports as plain
object(SQL Serversql_variant, e.g.SERVERPROPERTY('IsLocalDB')) failed to map when the boxed value didn't match the member type, like anInt32box into aboolorbool?. The query threwError parsing column 0 (IsLocalDB=0 - Int32)withSpecified cast is not valid.The DateOnly/TimeOnly change (#2228) added
colType == typeof(object)to the direct unbox condition for every target type. I limited it to targets that are themselvesTypeCode.Object(Guid, DateOnly, byte[] and so on). Primitive and string targets go back through the flexible convert path like in 2.1.79, where a plainboolmember worked. Nullable ones such asbool?use it too.The array mapping in #2231 and #2239 is separate and doesn't touch that clause. I added
ObjectTypedColumnsConvertToMemberTypeandSqlVariantIntToBooltoDataReaderTests.dotnet test tests/Dapper.Tests -f net10.0passes against SQL Server 2022.Fixes #2234
Assisted by Claude/Codex.