diff --git a/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerSingletonOptions.cs b/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerSingletonOptions.cs index 90b43fe769b..98c5f8727ee 100644 --- a/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerSingletonOptions.cs +++ b/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerSingletonOptions.cs @@ -70,11 +70,7 @@ public virtual bool SupportsJsonType => EngineType switch { SqlServerEngineType.SqlServer => SqlServerCompatibilityLevel >= 170, - // TODO: #36460 - // At the time of writing, Azure SQL Database does not yet support OPENJSON over the JSON data type. - // This should get reenabled by the time we GA. - SqlServerEngineType.AzureSql => false, - // SqlServerEngineType.AzureSql => AzureSqlCompatibilityLevel >= 170, + SqlServerEngineType.AzureSql => AzureSqlCompatibilityLevel >= 170, SqlServerEngineType.AzureSynapse => false, SqlServerEngineType.Unknown => false, // TODO: We shouldn't observe Unknown here, #36477 _ => throw new UnreachableException() diff --git a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs index 838d0cd19b7..d4790b81704 100644 --- a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs +++ b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs @@ -606,10 +606,7 @@ protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExp // 3. Can do JSON-specific decoding (e.g. base64 for varbinary) // Note that RETURNING is only (currently) supported over the json type (not nvarchar(max)). // Note that we don't need to check the compatibility level - if the json type is being used, then RETURNING is supported. - var useJsonValueReturningClause = !jsonQuery - && jsonScalarExpression.Json.TypeMapping?.StoreType is "json" - // Temporarily disabling for Azure SQL, which doesn't yet support RETURNING; this should get removed for 10 (see #36460). - && _sqlServerSingletonOptions.EngineType is not SqlServerEngineType.AzureSql; + var useJsonValueReturningClause = !jsonQuery && jsonScalarExpression.Json.TypeMapping?.StoreType is "json"; // For JSON_VALUE(), if we can use the RETURNING clause, always do that. // Otherwise, JSON_VALUE always returns nvarchar(4000) (https://learn.microsoft.com/sql/t-sql/functions/json-value-transact-sql), diff --git a/test/EFCore.SqlServer.Tests/Storage/SqlServerTypeMappingSourceTest.cs b/test/EFCore.SqlServer.Tests/Storage/SqlServerTypeMappingSourceTest.cs index 1859ff057cd..6a19f0a3b8c 100644 --- a/test/EFCore.SqlServer.Tests/Storage/SqlServerTypeMappingSourceTest.cs +++ b/test/EFCore.SqlServer.Tests/Storage/SqlServerTypeMappingSourceTest.cs @@ -1588,13 +1588,8 @@ public void Json_is_mapped_to_json_type_with_UseAzureSql_by_default() { var typeMappingSource = CreateTypeMappingSource(o => o.UseAzureSql()); - // TODO: #36460 - // At the time of writing, Azure SQL Database does not yet support OPENJSON over the JSON data type. - // This should get reenabled by the time we GA. - Assert.Equal("nvarchar(max)", typeMappingSource.GetMapping(typeof(JsonTypePlaceholder)).StoreType); - Assert.Equal("nvarchar(max)", typeMappingSource.GetMapping(typeof(int[])).StoreType); - // Assert.Equal("json", typeMappingSource.GetMapping(typeof(JsonTypePlaceholder)).StoreType); - // Assert.Equal("json", typeMappingSource.GetMapping(typeof(int[])).StoreType); + Assert.Equal("json", typeMappingSource.GetMapping(typeof(JsonTypePlaceholder)).StoreType); + Assert.Equal("json", typeMappingSource.GetMapping(typeof(int[])).StoreType); } [ConditionalFact]