Entity Framework with sql_variant column #3999
Unanswered
anilknarayan
asked this question in
Q&A
Replies: 1 comment
-
I found a way around this problem however it is a bit hacky. I added a string property - valString which will hold the string representation of the val sql_variant property (column). This property can be queried against. I have a DbCommandInterceptor that catches the SQL before submitting it and I manipulate the SQL before it gets executed. So every reference to valString is replaced by CAST(val as NVARCHAR(MAX)) AS valString. I have to make sure that when val appears in a WHERE clause it ends up being converted to CAST(val as NVARCHAR(MAX)) = 'x'. This seems to work while I wait for an elegant solution. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using a SQL Server database table that has a column of datatype - sql_variant. The Entity property for this column ends up being of type 'object'. Hot Chocolate does not expose this field at all. However, I do need to expose this field? How do I do that?
Beta Was this translation helpful? Give feedback.
All reactions