-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Repro code:
https://gist.github.com/bachratyg/d3a985224d29c48f51df8f7b1e49a32d
The same query expression (obviously different sql) used to work with EFC7.0 and EntityFrameworkCore.SqlServer.HierarchyId 4.0.0.
This is the generated query:
DECLARE @__ids_0 nvarchar(4000) = N'["/1/","/2/"]';
SELECT [s].[Id], [s].[Name]
FROM [Stuffs] AS [s]
WHERE [s].[Id] IN (
SELECT [i].[value]
FROM OPENJSON(@__ids_0) WITH ([value] hierarchyid '$') AS [i]
)SQL Server returns the following error:
CLR types cannot be used as column types in OPENJSON function with explicit schema.
CLR types are not supported in WITH clause.
If the type of [value] is changed from hierarchyid to nvarchar(max) on the last line implicit conversion kicks in and the command runs just fine with the new pattern. Query plan looks the same. Or simply just revert to the old behavior for types that are not supposed to work. I'm guessing spatial is in the same bucket.
Environment
EF Core version: 8.0.0-rc.1.23419.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0-rc1
SQL Server: 16.0.1050.5