Sql Server Schema that I am working with has sql_variant
DataType as a part of Table Type Parameter
Column. Also there's non TVP parameter which is sql_variant
. For the TVP parameter, I have used the option provided in the following link:
https://stackoverflow.com/a/52736573/1559611
It have used List<SqlDataRecord>
, which can be added to the DynamicParameters
, since AsTableValuedParameter()
has an extension method for IEnumerable<SqlDataRecord>
.
Before trying the above option I have tried mapping an object
and string
type to sql_variant
for a TVP column, but that leads to the exception.
Now I am trying to figure out:
- How to map a non TVP parameter for Dapper, since I don't see an option similar to
SqlDataRecord
, would a simpleobject
type work in that case ? - When return collection contains column, which is of variant type, will it map to an
object
type ?
My only option, if Dapper doesn't support is to switch back to SqlClient, which does have an explicit support for Sql_Variant data type, which doesn't seems to be case for Dapper as it use DbType
, which has no explicit Variant data type
Any help or pointer on these cases ?