diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerTestBase.cs b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerTestBase.cs index 88339869a3e..8fb5520899c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerTestBase.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerTestBase.cs @@ -444,7 +444,7 @@ INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReferenc #region EnumLegacyValues - [ConditionalTheory, MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "#36626"), MemberData(nameof(IsAsyncData))] public virtual async Task Read_enum_property_with_legacy_values(bool async) { var contextFactory = await InitializeAsync( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs index f046735a38b..1cd9d0fa5f1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs @@ -4905,6 +4905,6 @@ protected override string StoreName => "ComplexNavigations160"; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(b => b.UseCompatibilityLevel(160)); + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(160); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs index feadbd56746..107f79fece0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs @@ -8525,6 +8525,6 @@ protected override string StoreName => "ComplexNavigationsOwned160"; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(b => b.UseCompatibilityLevel(160)); + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(160); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs index 104f4c5d756..ea72e060763 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs @@ -214,7 +214,7 @@ public override async Task Basic_json_projection_scalar(bool async) AssertSql( """ -SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') +SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) FROM [JsonEntitiesBasic] AS [j] """); } @@ -227,7 +227,7 @@ public override async Task Json_scalar_length(bool async) """ SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(LEN(JSON_VALUE([j].[OwnedReferenceRoot], '$.Name')) AS int) > 2 +WHERE CAST(LEN(JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max))) AS int) > 2 """); } @@ -237,7 +237,7 @@ public override async Task Basic_json_projection_enum_inside_json_entity(bool as AssertSql( """ -SELECT [j].[Id], CAST(JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Enum') AS int) AS [Enum] +SELECT [j].[Id], JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Enum' RETURNING int) AS [Enum] FROM [JsonEntitiesBasic] AS [j] """); } @@ -248,7 +248,7 @@ public override async Task Json_projection_enum_with_custom_conversion(bool asyn AssertSql( """ -SELECT [j].[Id], CAST(JSON_VALUE([j].[json_reference_custom_naming], '$."1CustomEnum"') AS int) AS [Enum] +SELECT [j].[Id], JSON_VALUE([j].[json_reference_custom_naming], '$."1CustomEnum"' RETURNING int) AS [Enum] FROM [JsonEntitiesCustomNaming] AS [j] """); } @@ -283,7 +283,7 @@ public override async Task Json_property_in_predicate(bool async) """ SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Fraction') AS decimal(18,2)) < 20.5 +WHERE JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Fraction' RETURNING decimal(18,2)) < 20.5 """); } @@ -299,7 +299,7 @@ SELECT CAST(LEN([j1].[c]) AS int) FROM ( SELECT DISTINCT [j0].[c] FROM ( - SELECT TOP(@p) JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS [c] + SELECT TOP(@p) JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething' RETURNING nvarchar(max)) AS [c] FROM [JsonEntitiesBasic] AS [j] ORDER BY [j].[Id] ) AS [j0] @@ -352,7 +352,10 @@ ORDER BY [j].[Id] public override async Task Json_subquery_reference_pushdown_reference_pushdown_anonymous_projection(bool async) { - await base.Json_subquery_reference_pushdown_reference_pushdown_anonymous_projection(async); + // TODO:SQLJSON Json type is not comparable + Assert.Equal( + "The json data type cannot be selected as DISTINCT because it is not comparable.", + (await Assert.ThrowsAsync(() => base.Json_subquery_reference_pushdown_reference(async))).Message); AssertSql( """ @@ -402,7 +405,7 @@ FROM [JsonEntitiesBasic] AS [j] ORDER BY [j].[Id] ) AS [j0] ) AS [j1] - ORDER BY JSON_VALUE([j1].[c0], '$.Name') + ORDER BY JSON_VALUE([j1].[c0], '$.Name' RETURNING nvarchar(max)) ) AS [j2] ) AS [j3] """); @@ -433,7 +436,7 @@ FROM [JsonEntitiesBasic] AS [j] ORDER BY [j].[Id] ) AS [j0] ) AS [j1] - ORDER BY JSON_VALUE([j1].[c0], '$.Name') + ORDER BY JSON_VALUE([j1].[c0], '$.Name' RETURNING nvarchar(max)) ) AS [j2] ) AS [j3] """); @@ -450,7 +453,7 @@ public override async Task Json_subquery_reference_pushdown_property(bool async) """ @p='10' -SELECT JSON_VALUE([j1].[c], '$.SomethingSomething') +SELECT JSON_VALUE([j1].[c], '$.SomethingSomething' RETURNING nvarchar(max)) FROM ( SELECT DISTINCT [j0].[c] AS [c], [j0].[Id] FROM ( @@ -502,7 +505,7 @@ public override async Task Custom_naming_projection_owned_scalar(bool async) AssertSql( """ -SELECT CAST(JSON_VALUE([j].[json_reference_custom_naming], '$."Custom#OwnedReferenceBranch\u0060-=[]\\;\u0027,./~!@#$%^\u0026*()_\u002B{}|:\u0022\u003C\u003E?\u72EC\u89D2\u517D\u03C0\u7368\u89D2\u7378"."\u30E6\u30CB\u30B3\u30FC\u30F3Fraction\u4E00\u89D2\u7363"') AS float) +SELECT JSON_VALUE([j].[json_reference_custom_naming], '$."Custom#OwnedReferenceBranch\u0060-=[]\\;\u0027,./~!@#$%^\u0026*()_\u002B{}|:\u0022\u003C\u003E?\u72EC\u89D2\u517D\u03C0\u7368\u89D2\u7378"."\u30E6\u30CB\u30B3\u30FC\u30F3Fraction\u4E00\u89D2\u7363"' RETURNING float) FROM [JsonEntitiesCustomNaming] AS [j] """); } @@ -513,7 +516,7 @@ public override async Task Custom_naming_projection_everything(bool async) AssertSql( """ -SELECT [j].[Id], [j].[Title], [j].[json_collection_custom_naming], [j].[json_reference_custom_naming], [j].[json_reference_custom_naming], JSON_QUERY([j].[json_reference_custom_naming], '$."Custom#OwnedReferenceBranch\u0060-=[]\\;\u0027,./~!@#$%^\u0026*()_\u002B{}|:\u0022\u003C\u003E?\u72EC\u89D2\u517D\u03C0\u7368\u89D2\u7378"'), [j].[json_collection_custom_naming], JSON_QUERY([j].[json_reference_custom_naming], '$.CustomOwnedCollectionBranch'), JSON_VALUE([j].[json_reference_custom_naming], '$.CustomName'), CAST(JSON_VALUE([j].[json_reference_custom_naming], '$."Custom#OwnedReferenceBranch\u0060-=[]\\;\u0027,./~!@#$%^\u0026*()_\u002B{}|:\u0022\u003C\u003E?\u72EC\u89D2\u517D\u03C0\u7368\u89D2\u7378"."\u30E6\u30CB\u30B3\u30FC\u30F3Fraction\u4E00\u89D2\u7363"') AS float) +SELECT [j].[Id], [j].[Title], [j].[json_collection_custom_naming], [j].[json_reference_custom_naming], [j].[json_reference_custom_naming], JSON_QUERY([j].[json_reference_custom_naming], '$."Custom#OwnedReferenceBranch\u0060-=[]\\;\u0027,./~!@#$%^\u0026*()_\u002B{}|:\u0022\u003C\u003E?\u72EC\u89D2\u517D\u03C0\u7368\u89D2\u7378"'), [j].[json_collection_custom_naming], JSON_QUERY([j].[json_reference_custom_naming], '$.CustomOwnedCollectionBranch'), JSON_VALUE([j].[json_reference_custom_naming], '$.CustomName' RETURNING nvarchar(max)), JSON_VALUE([j].[json_reference_custom_naming], '$."Custom#OwnedReferenceBranch\u0060-=[]\\;\u0027,./~!@#$%^\u0026*()_\u002B{}|:\u0022\u003C\u003E?\u72EC\u89D2\u517D\u03C0\u7368\u89D2\u7378"."\u30E6\u30CB\u30B3\u30FC\u30F3Fraction\u4E00\u89D2\u7363"' RETURNING float) FROM [JsonEntitiesCustomNaming] AS [j] """); } @@ -531,20 +534,7 @@ FROM [JsonEntitiesSingleOwned] AS [j] public override async Task LeftJoin_json_entities(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.LeftJoin_json_entities(true))).Message); - } - else - { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.LeftJoin_json_entities(false))) - .Message); - } + await base.LeftJoin_json_entities(async); AssertSql( """ @@ -556,45 +546,19 @@ FROM [JsonEntitiesSingleOwned] AS [j] public override async Task RightJoin_json_entities(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.LeftJoin_json_entities(true))).Message); - } - else - { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.LeftJoin_json_entities(false))) - .Message); - } + await base.RightJoin_json_entities(async); AssertSql( """ -SELECT [j].[Id], [j].[Name], [j].[OwnedCollection], [j0].[Id], [j0].[EntityBasicId], [j0].[Name], [j0].[OwnedCollectionRoot], [j0].[OwnedReferenceRoot] -FROM [JsonEntitiesSingleOwned] AS [j] -RIGHT JOIN [JsonEntitiesBasic] AS [j0] ON [j].[Id] = [j0].[Id] +SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot], [j0].[Id], [j0].[Name], [j0].[OwnedCollection] +FROM [JsonEntitiesBasic] AS [j] +RIGHT JOIN [JsonEntitiesSingleOwned] AS [j0] ON [j].[Id] = [j0].[Id] """); } public override async Task Left_join_json_entities_complex_projection(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.Left_join_json_entities_complex_projection(true))).Message); - } - else - { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.Left_join_json_entities_complex_projection(false))) - .Message); - } + await base.Left_join_json_entities_complex_projection(async); AssertSql( """ @@ -652,7 +616,7 @@ public override async Task Project_json_entity_FirstOrDefault_subquery_with_bind AssertSql( """ SELECT ( - SELECT TOP(1) CAST(JSON_VALUE([j0].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Date') AS datetime2) + SELECT TOP(1) JSON_VALUE([j0].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Date' RETURNING datetime2) FROM [JsonEntitiesBasic] AS [j0] ORDER BY [j0].[Id]) FROM [JsonEntitiesBasic] AS [j] @@ -721,20 +685,7 @@ public override async Task Project_json_entity_FirstOrDefault_subquery_with_enti public override async Task Json_entity_with_inheritance_basic_projection(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.Json_entity_with_inheritance_basic_projection(true))).Message); - } - else - { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.Json_entity_with_inheritance_basic_projection(false))) - .Message); - } + await base.Json_entity_with_inheritance_basic_projection(async); AssertSql( """ @@ -904,20 +855,7 @@ public override async Task Json_collection_index_in_projection_using_untranslata public override async Task Json_collection_index_outside_bounds(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.Json_collection_index_outside_bounds(true))).Message); - } - else - { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.Json_collection_index_outside_bounds(false))) - .Message); - } + await base.Json_collection_index_outside_bounds(async); AssertSql( """ @@ -928,20 +866,7 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Json_collection_index_outside_bounds2(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.Json_collection_index_outside_bounds2(true))).Message); - } - else - { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.Json_collection_index_outside_bounds2(false))) - .Message); - } + await base.Json_collection_index_outside_bounds2(async); AssertSql( """ @@ -956,7 +881,7 @@ public override async Task Json_collection_index_outside_bounds_with_property_ac AssertSql( """ -SELECT CAST(JSON_VALUE([j].[OwnedCollectionRoot], '$[25].Number') AS int) +SELECT JSON_VALUE([j].[OwnedCollectionRoot], '$[25].Number' RETURNING int) FROM [JsonEntitiesBasic] AS [j] ORDER BY [j].[Id] """); @@ -985,7 +910,7 @@ public override async Task Json_collection_index_in_projection_nested_project_sc """ @prm='1' -SELECT CAST(JSON_VALUE([j].[OwnedCollectionRoot], '$[0].OwnedCollectionBranch[' + CAST(@prm AS nvarchar(max)) + '].Date') AS datetime2) +SELECT JSON_VALUE([j].[OwnedCollectionRoot], '$[0].OwnedCollectionBranch[' + CAST(@prm AS nvarchar(max)) + '].Date' RETURNING datetime2) FROM [JsonEntitiesBasic] AS [j] """); } @@ -1041,7 +966,7 @@ public override async Task Json_collection_index_in_predicate_using_constant(boo """ SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') IS NULL +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name' RETURNING nvarchar(max)) <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name' RETURNING nvarchar(max)) IS NULL """); } @@ -1056,7 +981,7 @@ public override async Task Json_collection_index_in_predicate_using_variable(boo SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@prm AS nvarchar(max)) + '].Name') <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@prm AS nvarchar(max)) + '].Name') IS NULL +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@prm AS nvarchar(max)) + '].Name' RETURNING nvarchar(max)) <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@prm AS nvarchar(max)) + '].Name' RETURNING nvarchar(max)) IS NULL """); } @@ -1069,7 +994,7 @@ public override async Task Json_collection_index_in_predicate_using_column(bool """ SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST([j].[Id] AS nvarchar(max)) + '].Name') = N'e1_c2' +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST([j].[Id] AS nvarchar(max)) + '].Name' RETURNING nvarchar(max)) = N'e1_c2' """); } @@ -1085,7 +1010,7 @@ FROM [JsonEntitiesBasic] AS [j] WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(CASE WHEN [j].[Id] = 1 THEN 0 ELSE 1 -END AS nvarchar(max)) + '].Name') = N'e1_c1' +END AS nvarchar(max)) + '].Name' RETURNING nvarchar(max)) = N'e1_c1' """); } @@ -1100,7 +1025,7 @@ public override async Task Json_collection_index_in_predicate_using_complex_expr FROM [JsonEntitiesBasic] AS [j] WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(( SELECT MAX([j0].[Id]) - FROM [JsonEntitiesBasic] AS [j0]) AS nvarchar(max)) + '].Name') = N'e1_c2' + FROM [JsonEntitiesBasic] AS [j0]) AS nvarchar(max)) + '].Name' RETURNING nvarchar(max)) = N'e1_c2' """); } @@ -1112,7 +1037,7 @@ public override async Task Json_collection_ElementAt_in_predicate(bool async) """ SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name') <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name') IS NULL +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name' RETURNING nvarchar(max)) <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name' RETURNING nvarchar(max)) IS NULL """); } @@ -1127,7 +1052,7 @@ public override async Task Json_collection_index_in_predicate_nested_mix(bool as SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[1].OwnedCollectionBranch[' + CAST(@prm AS nvarchar(max)) + '].OwnedCollectionLeaf[' + CAST([j].[Id] - 1 AS nvarchar(max)) + '].SomethingSomething') = N'e1_c2_c1_c1' +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[1].OwnedCollectionBranch[' + CAST(@prm AS nvarchar(max)) + '].OwnedCollectionLeaf[' + CAST([j].[Id] - 1 AS nvarchar(max)) + '].SomethingSomething' RETURNING nvarchar(max)) = N'e1_c2_c1_c1' """); } @@ -1137,11 +1062,12 @@ public override async Task Json_collection_ElementAt_and_pushdown(bool async) AssertSql( """ -SELECT [j].[Id], CAST(JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Number') AS int) AS [CollectionElement] +SELECT [j].[Id], JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Number' RETURNING int) AS [CollectionElement] FROM [JsonEntitiesBasic] AS [j] """); } + [ConditionalTheory(Skip = "#36628")] public override async Task Json_collection_Any_with_predicate(bool async) { await base.Json_collection_Any_with_predicate(async); @@ -1152,8 +1078,8 @@ public override async Task Json_collection_Any_with_predicate(bool async) FROM [JsonEntitiesBasic] AS [j] WHERE EXISTS ( SELECT 1 - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedCollectionBranch') WITH ([OwnedReferenceLeaf] nvarchar(max) '$.OwnedReferenceLeaf' AS JSON) AS [o] - WHERE JSON_VALUE([o].[OwnedReferenceLeaf], '$.SomethingSomething') = N'e1_r_c1_r') + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedCollectionBranch') WITH ([OwnedReferenceLeaf] nvarchar(max) '$.OwnedReferenceLeaf' AS JSON) AS [o] + WHERE JSON_VALUE([o].[OwnedReferenceLeaf], '$.SomethingSomething' RETURNING nvarchar(max)) = N'e1_r_c1_r') """); } @@ -1167,7 +1093,7 @@ public override async Task Json_collection_Where_ElementAt(bool async) FROM [JsonEntitiesBasic] AS [j] WHERE ( SELECT JSON_VALUE([o].[value], '$.OwnedReferenceLeaf.SomethingSomething') - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedCollectionBranch') AS [o] + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedCollectionBranch') AS [o] WHERE CAST(JSON_VALUE([o].[value], '$.Enum') AS int) = -3 ORDER BY CAST([o].[key] AS int) OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = N'e1_r_c2_r' @@ -1186,7 +1112,7 @@ FROM [JsonEntitiesBasic] AS [j] SELECT [o0].[c] FROM ( SELECT JSON_VALUE([o].[value], '$.OwnedReferenceLeaf.SomethingSomething') AS [c], CAST([o].[key] AS int) AS [c0] - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedCollectionBranch') AS [o] + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedCollectionBranch') AS [o] ORDER BY CAST([o].[key] AS int) OFFSET 1 ROWS ) AS [o0] @@ -1195,6 +1121,7 @@ ORDER BY [o0].[c0] """); } + [ConditionalTheory(Skip = "#36628")] public override async Task Json_collection_OrderByDescending_Skip_ElementAt(bool async) { await base.Json_collection_OrderByDescending_Skip_ElementAt(async); @@ -1221,6 +1148,7 @@ ORDER BY [o0].[c0] DESC """); } + [ConditionalTheory(Skip = "#36628")] public override async Task Json_collection_Distinct_Count_with_predicate(bool async) { await base.Json_collection_Distinct_Count_with_predicate(async); @@ -1258,10 +1186,10 @@ public override async Task Json_collection_within_collection_Count(bool async) FROM [JsonEntitiesBasic] AS [j] WHERE EXISTS ( SELECT 1 - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') WITH ([OwnedCollectionBranch] nvarchar(max) '$.OwnedCollectionBranch' AS JSON) AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') WITH ([OwnedCollectionBranch] nvarchar(max) '$.OwnedCollectionBranch' AS JSON) AS [o] WHERE ( SELECT COUNT(*) - FROM OPENJSON(CAST([o].[OwnedCollectionBranch] AS nvarchar(max)), '$') AS [o0]) = 2) + FROM OPENJSON([o].[OwnedCollectionBranch], '$') AS [o0]) = 2) """); } @@ -1273,7 +1201,7 @@ public override async Task Json_collection_in_projection_with_composition_count( """ SELECT ( SELECT COUNT(*) - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o]) + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o]) FROM [JsonEntitiesBasic] AS [j] ORDER BY [j].[Id] """); @@ -1287,7 +1215,7 @@ public override async Task Json_collection_in_projection_with_anonymous_projecti """ SELECT [j].[Id], JSON_VALUE([o].[value], '$.Name'), CAST(JSON_VALUE([o].[value], '$.Number') AS int), [o].[key] FROM [JsonEntitiesBasic] AS [j] -OUTER APPLY OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] +OUTER APPLY OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] ORDER BY [j].[Id], CAST([o].[key] AS int) """); } @@ -1302,7 +1230,7 @@ public override async Task Json_collection_in_projection_with_composition_where_ FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT JSON_VALUE([o].[value], '$.Name') AS [Name], CAST(JSON_VALUE([o].[value], '$.Number') AS int) AS [Number], [o].[key], CAST([o].[key] AS int) AS [c] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] WHERE JSON_VALUE([o].[value], '$.Name') = N'Foo' ) AS [o0] ORDER BY [j].[Id], [o0].[c] @@ -1319,7 +1247,7 @@ public override async Task Json_collection_in_projection_with_composition_where_ FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT JSON_QUERY([o].[value], '$.Names') AS [Names], JSON_QUERY([o].[value], '$.Numbers') AS [Numbers], [o].[key], CAST([o].[key] AS int) AS [c] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] WHERE JSON_VALUE([o].[value], '$.Name') = N'Foo' ) AS [o0] ORDER BY [j].[Id], [o0].[c] @@ -1332,11 +1260,11 @@ public override async Task Json_collection_filter_in_projection(bool async) AssertSql( """ -SELECT [j].[Id], [o0].[Id], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[c], [o0].[c0], [o0].[key] +SELECT [j].[Id], [o0].[Id], [o0].[Id0], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[c], [o0].[c0], [o0].[key] FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( - SELECT [j].[Id], JSON_VALUE([o].[value], '$.Name') AS [Name], JSON_QUERY([o].[value], '$.Names') AS [Names], CAST(JSON_VALUE([o].[value], '$.Number') AS int) AS [Number], JSON_QUERY([o].[value], '$.Numbers') AS [Numbers], JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS [c], JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c0], [o].[key], CAST([o].[key] AS int) AS [c1] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + SELECT [j].[Id], CAST(JSON_VALUE([o].[value], '$.Id') AS int) AS [Id0], JSON_VALUE([o].[value], '$.Name') AS [Name], JSON_QUERY([o].[value], '$.Names') AS [Names], CAST(JSON_VALUE([o].[value], '$.Number') AS int) AS [Number], JSON_QUERY([o].[value], '$.Numbers') AS [Numbers], JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS [c], JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c0], [o].[key], CAST([o].[key] AS int) AS [c1] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] WHERE JSON_VALUE([o].[value], '$.Name') <> N'Foo' OR JSON_VALUE([o].[value], '$.Name') IS NULL ) AS [o0] ORDER BY [j].[Id], [o0].[c1] @@ -1349,14 +1277,14 @@ public override async Task Json_nested_collection_filter_in_projection(bool asyn AssertSql( """ -SELECT [j].[Id], [s].[key], [s].[Id], [s].[Date], [s].[Enum], [s].[Enums], [s].[Fraction], [s].[NullableEnum], [s].[NullableEnums], [s].[c], [s].[c0], [s].[key0] +SELECT [j].[Id], [s].[key], [s].[Id], [s].[Date], [s].[Enum], [s].[Enums], [s].[Fraction], [s].[Id0], [s].[NullableEnum], [s].[NullableEnums], [s].[c], [s].[c0], [s].[key0] FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( - SELECT [o].[key], [o1].[Id], [o1].[Date], [o1].[Enum], [o1].[Enums], [o1].[Fraction], [o1].[NullableEnum], [o1].[NullableEnums], [o1].[c], [o1].[c0], [o1].[key] AS [key0], CAST([o].[key] AS int) AS [c1], [o1].[c1] AS [c10] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + SELECT [o].[key], [o1].[Id], [o1].[Date], [o1].[Enum], [o1].[Enums], [o1].[Fraction], [o1].[Id0], [o1].[NullableEnum], [o1].[NullableEnums], [o1].[c], [o1].[c0], [o1].[key] AS [key0], CAST([o].[key] AS int) AS [c1], [o1].[c1] AS [c10] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] OUTER APPLY ( - SELECT [j].[Id], CAST(JSON_VALUE([o0].[value], '$.Date') AS datetime2) AS [Date], CAST(JSON_VALUE([o0].[value], '$.Enum') AS int) AS [Enum], JSON_QUERY([o0].[value], '$.Enums') AS [Enums], CAST(JSON_VALUE([o0].[value], '$.Fraction') AS decimal(18,2)) AS [Fraction], CAST(JSON_VALUE([o0].[value], '$.NullableEnum') AS int) AS [NullableEnum], JSON_QUERY([o0].[value], '$.NullableEnums') AS [NullableEnums], JSON_QUERY([o0].[value], '$.OwnedCollectionLeaf') AS [c], JSON_QUERY([o0].[value], '$.OwnedReferenceLeaf') AS [c0], [o0].[key], CAST([o0].[key] AS int) AS [c1] - FROM OPENJSON(CAST(JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS nvarchar(max)), '$') AS [o0] + SELECT [j].[Id], CAST(JSON_VALUE([o0].[value], '$.Date') AS datetime2) AS [Date], CAST(JSON_VALUE([o0].[value], '$.Enum') AS int) AS [Enum], JSON_QUERY([o0].[value], '$.Enums') AS [Enums], CAST(JSON_VALUE([o0].[value], '$.Fraction') AS decimal(18,2)) AS [Fraction], CAST(JSON_VALUE([o0].[value], '$.Id') AS int) AS [Id0], CAST(JSON_VALUE([o0].[value], '$.NullableEnum') AS int) AS [NullableEnum], JSON_QUERY([o0].[value], '$.NullableEnums') AS [NullableEnums], JSON_QUERY([o0].[value], '$.OwnedCollectionLeaf') AS [c], JSON_QUERY([o0].[value], '$.OwnedReferenceLeaf') AS [c0], [o0].[key], CAST([o0].[key] AS int) AS [c1] + FROM OPENJSON(JSON_QUERY([o].[value], '$.OwnedCollectionBranch'), '$') AS [o0] WHERE CAST(JSON_VALUE([o0].[value], '$.Date') AS datetime2) <> '2000-01-01T00:00:00.0000000' ) AS [o1] ) AS [s] @@ -1374,8 +1302,8 @@ public override async Task Json_nested_collection_anonymous_projection_in_projec FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT [o].[key], CAST(JSON_VALUE([o0].[value], '$.Date') AS datetime2) AS [c], CAST(JSON_VALUE([o0].[value], '$.Enum') AS int) AS [c0], JSON_QUERY([o0].[value], '$.Enums') AS [c1], CAST(JSON_VALUE([o0].[value], '$.Fraction') AS decimal(18,2)) AS [c2], JSON_QUERY([o0].[value], '$.OwnedReferenceLeaf') AS [c3], [j].[Id], JSON_QUERY([o0].[value], '$.OwnedCollectionLeaf') AS [c4], [o0].[key] AS [key0], CAST([o].[key] AS int) AS [c5], CAST([o0].[key] AS int) AS [c6] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] - OUTER APPLY OPENJSON(CAST(JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS nvarchar(max)), '$') AS [o0] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] + OUTER APPLY OPENJSON(JSON_QUERY([o].[value], '$.OwnedCollectionBranch'), '$') AS [o0] ) AS [s] ORDER BY [j].[Id], [s].[c5], [s].[key], [s].[c6] """); @@ -1387,11 +1315,11 @@ public override async Task Json_collection_skip_take_in_projection(bool async) AssertSql( """ -SELECT [j].[Id], [o0].[Id], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[c], [o0].[c0], [o0].[key] +SELECT [j].[Id], [o0].[Id], [o0].[Id0], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[c], [o0].[c0], [o0].[key] FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( - SELECT [j].[Id], JSON_VALUE([o].[value], '$.Name') AS [Name], JSON_QUERY([o].[value], '$.Names') AS [Names], CAST(JSON_VALUE([o].[value], '$.Number') AS int) AS [Number], JSON_QUERY([o].[value], '$.Numbers') AS [Numbers], JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS [c], JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c0], [o].[key], JSON_VALUE([o].[value], '$.Name') AS [c1] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + SELECT [j].[Id], CAST(JSON_VALUE([o].[value], '$.Id') AS int) AS [Id0], JSON_VALUE([o].[value], '$.Name') AS [Name], JSON_QUERY([o].[value], '$.Names') AS [Names], CAST(JSON_VALUE([o].[value], '$.Number') AS int) AS [Number], JSON_QUERY([o].[value], '$.Numbers') AS [Numbers], JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS [c], JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c0], [o].[key], JSON_VALUE([o].[value], '$.Name') AS [c1] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] ORDER BY JSON_VALUE([o].[value], '$.Name') OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [o0] @@ -1409,7 +1337,7 @@ public override async Task Json_collection_skip_take_in_projection_project_into_ FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT JSON_VALUE([o].[value], '$.Name') AS [c], JSON_QUERY([o].[value], '$.Names') AS [c0], CAST(JSON_VALUE([o].[value], '$.Number') AS int) AS [c1], JSON_QUERY([o].[value], '$.Numbers') AS [c2], JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS [c3], [j].[Id], JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c4], [o].[key] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] ORDER BY JSON_VALUE([o].[value], '$.Name') OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [o0] @@ -1427,7 +1355,7 @@ public override async Task Json_collection_skip_take_in_projection_with_json_ref FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c], [j].[Id], [o].[key], JSON_VALUE([o].[value], '$.Name') AS [c0] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] ORDER BY JSON_VALUE([o].[value], '$.Name') OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [o0] @@ -1441,11 +1369,12 @@ public override async Task Json_collection_distinct_in_projection(bool async) AssertSql( """ -SELECT [j].[Id], [o0].[Id], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[c], [o0].[c0] +SELECT [j].[Id], [o0].[Id], [o0].[Id0], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[c], [o0].[c0] FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( - SELECT DISTINCT [j].[Id], [o].[Name], [o].[Names], [o].[Number], [o].[Numbers], [o].[OwnedCollectionBranch] AS [c], [o].[OwnedReferenceBranch] AS [c0] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') WITH ( + SELECT DISTINCT [j].[Id], [o].[Id] AS [Id0], [o].[Name], [o].[Names], [o].[Number], [o].[Numbers], [o].[OwnedCollectionBranch] AS [c], [o].[OwnedReferenceBranch] AS [c0] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') WITH ( + [Id] int '$.Id', [Name] nvarchar(max) '$.Name', [Names] nvarchar(max) '$.Names' AS JSON, [Number] int '$.Number', @@ -1454,7 +1383,7 @@ [OwnedCollectionBranch] nvarchar(max) '$.OwnedCollectionBranch' AS JSON, [OwnedReferenceBranch] nvarchar(max) '$.OwnedReferenceBranch' AS JSON ) AS [o] ) AS [o0] -ORDER BY [j].[Id], [o0].[Name], [o0].[Names], [o0].[Number] +ORDER BY [j].[Id], [o0].[Id0], [o0].[Name], [o0].[Names], [o0].[Number] """); } @@ -1475,7 +1404,7 @@ public override async Task Json_collection_leaf_filter_in_projection(bool async) FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT [j].[Id], JSON_VALUE([o].[value], '$.SomethingSomething') AS [SomethingSomething], [o].[key], CAST([o].[key] AS int) AS [c] - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedReferenceBranch.OwnedCollectionLeaf') AS [o] + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedCollectionLeaf') AS [o] WHERE JSON_VALUE([o].[value], '$.SomethingSomething') <> N'Baz' OR JSON_VALUE([o].[value], '$.SomethingSomething') IS NULL ) AS [o0] ORDER BY [j].[Id], [o0].[c] @@ -1488,16 +1417,17 @@ public override async Task Json_multiple_collection_projections(bool async) AssertSql( """ -SELECT [j].[Id], [o4].[Id], [o4].[SomethingSomething], [o4].[key], [o1].[Id], [o1].[Name], [o1].[Names], [o1].[Number], [o1].[Numbers], [o1].[c], [o1].[c0], [s].[key], [s].[Id], [s].[Date], [s].[Enum], [s].[Enums], [s].[Fraction], [s].[NullableEnum], [s].[NullableEnums], [s].[c], [s].[c0], [s].[key0], [j0].[Id], [j0].[Name], [j0].[ParentId] +SELECT [j].[Id], [o4].[Id], [o4].[SomethingSomething], [o4].[key], [o1].[Id], [o1].[Id0], [o1].[Name], [o1].[Names], [o1].[Number], [o1].[Numbers], [o1].[c], [o1].[c0], [s].[key], [s].[Id], [s].[Date], [s].[Enum], [s].[Enums], [s].[Fraction], [s].[Id0], [s].[NullableEnum], [s].[NullableEnums], [s].[c], [s].[c0], [s].[key0], [j0].[Id], [j0].[Name], [j0].[ParentId] FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT [j].[Id], JSON_VALUE([o].[value], '$.SomethingSomething') AS [SomethingSomething], [o].[key], CAST([o].[key] AS int) AS [c] - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedReferenceBranch.OwnedCollectionLeaf') AS [o] + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedCollectionLeaf') AS [o] WHERE JSON_VALUE([o].[value], '$.SomethingSomething') <> N'Baz' OR JSON_VALUE([o].[value], '$.SomethingSomething') IS NULL ) AS [o4] OUTER APPLY ( - SELECT DISTINCT [j].[Id], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[OwnedCollectionBranch] AS [c], [o0].[OwnedReferenceBranch] AS [c0] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') WITH ( + SELECT DISTINCT [j].[Id], [o0].[Id] AS [Id0], [o0].[Name], [o0].[Names], [o0].[Number], [o0].[Numbers], [o0].[OwnedCollectionBranch] AS [c], [o0].[OwnedReferenceBranch] AS [c0] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') WITH ( + [Id] int '$.Id', [Name] nvarchar(max) '$.Name', [Names] nvarchar(max) '$.Names' AS JSON, [Number] int '$.Number', @@ -1507,16 +1437,16 @@ [OwnedReferenceBranch] nvarchar(max) '$.OwnedReferenceBranch' AS JSON ) AS [o0] ) AS [o1] OUTER APPLY ( - SELECT [o2].[key], [o5].[Id], [o5].[Date], [o5].[Enum], [o5].[Enums], [o5].[Fraction], [o5].[NullableEnum], [o5].[NullableEnums], [o5].[c], [o5].[c0], [o5].[key] AS [key0], CAST([o2].[key] AS int) AS [c1], [o5].[c1] AS [c10] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o2] + SELECT [o2].[key], [o5].[Id], [o5].[Date], [o5].[Enum], [o5].[Enums], [o5].[Fraction], [o5].[Id0], [o5].[NullableEnum], [o5].[NullableEnums], [o5].[c], [o5].[c0], [o5].[key] AS [key0], CAST([o2].[key] AS int) AS [c1], [o5].[c1] AS [c10] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o2] OUTER APPLY ( - SELECT [j].[Id], CAST(JSON_VALUE([o3].[value], '$.Date') AS datetime2) AS [Date], CAST(JSON_VALUE([o3].[value], '$.Enum') AS int) AS [Enum], JSON_QUERY([o3].[value], '$.Enums') AS [Enums], CAST(JSON_VALUE([o3].[value], '$.Fraction') AS decimal(18,2)) AS [Fraction], CAST(JSON_VALUE([o3].[value], '$.NullableEnum') AS int) AS [NullableEnum], JSON_QUERY([o3].[value], '$.NullableEnums') AS [NullableEnums], JSON_QUERY([o3].[value], '$.OwnedCollectionLeaf') AS [c], JSON_QUERY([o3].[value], '$.OwnedReferenceLeaf') AS [c0], [o3].[key], CAST([o3].[key] AS int) AS [c1] - FROM OPENJSON(CAST(JSON_QUERY([o2].[value], '$.OwnedCollectionBranch') AS nvarchar(max)), '$') AS [o3] + SELECT [j].[Id], CAST(JSON_VALUE([o3].[value], '$.Date') AS datetime2) AS [Date], CAST(JSON_VALUE([o3].[value], '$.Enum') AS int) AS [Enum], JSON_QUERY([o3].[value], '$.Enums') AS [Enums], CAST(JSON_VALUE([o3].[value], '$.Fraction') AS decimal(18,2)) AS [Fraction], CAST(JSON_VALUE([o3].[value], '$.Id') AS int) AS [Id0], CAST(JSON_VALUE([o3].[value], '$.NullableEnum') AS int) AS [NullableEnum], JSON_QUERY([o3].[value], '$.NullableEnums') AS [NullableEnums], JSON_QUERY([o3].[value], '$.OwnedCollectionLeaf') AS [c], JSON_QUERY([o3].[value], '$.OwnedReferenceLeaf') AS [c0], [o3].[key], CAST([o3].[key] AS int) AS [c1] + FROM OPENJSON(JSON_QUERY([o2].[value], '$.OwnedCollectionBranch'), '$') AS [o3] WHERE CAST(JSON_VALUE([o3].[value], '$.Date') AS datetime2) <> '2000-01-01T00:00:00.0000000' ) AS [o5] ) AS [s] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id], [o4].[c], [o4].[key], [o1].[Name], [o1].[Names], [o1].[Number], [o1].[Numbers], [s].[c1], [s].[key], [s].[c10], [s].[key0] +ORDER BY [j].[Id], [o4].[c], [o4].[key], [o1].[Id0], [o1].[Name], [o1].[Names], [o1].[Number], [o1].[Numbers], [s].[c1], [s].[key], [s].[c10], [s].[key0] """); } @@ -1526,15 +1456,16 @@ public override async Task Json_branch_collection_distinct_and_other_collection( AssertSql( """ -SELECT [j].[Id], [o0].[Id], [o0].[Date], [o0].[Enum], [o0].[Enums], [o0].[Fraction], [o0].[NullableEnum], [o0].[NullableEnums], [o0].[c], [o0].[c0], [j0].[Id], [j0].[Name], [j0].[ParentId] +SELECT [j].[Id], [o0].[Id], [o0].[Date], [o0].[Enum], [o0].[Enums], [o0].[Fraction], [o0].[Id0], [o0].[NullableEnum], [o0].[NullableEnums], [o0].[c], [o0].[c0], [j0].[Id], [j0].[Name], [j0].[ParentId] FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( - SELECT DISTINCT [j].[Id], [o].[Date], [o].[Enum], [o].[Enums], [o].[Fraction], [o].[NullableEnum], [o].[NullableEnums], [o].[OwnedCollectionLeaf] AS [c], [o].[OwnedReferenceLeaf] AS [c0] - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedCollectionBranch') WITH ( + SELECT DISTINCT [j].[Id], [o].[Date], [o].[Enum], [o].[Enums], [o].[Fraction], [o].[Id] AS [Id0], [o].[NullableEnum], [o].[NullableEnums], [o].[OwnedCollectionLeaf] AS [c], [o].[OwnedReferenceLeaf] AS [c0] + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedCollectionBranch') WITH ( [Date] datetime2 '$.Date', [Enum] int '$.Enum', [Enums] nvarchar(max) '$.Enums' AS JSON, [Fraction] decimal(18,2) '$.Fraction', + [Id] int '$.Id', [NullableEnum] int '$.NullableEnum', [NullableEnums] nvarchar(max) '$.NullableEnums' AS JSON, [OwnedCollectionLeaf] nvarchar(max) '$.OwnedCollectionLeaf' AS JSON, @@ -1542,7 +1473,7 @@ [OwnedReferenceLeaf] nvarchar(max) '$.OwnedReferenceLeaf' AS JSON ) AS [o] ) AS [o0] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id], [o0].[Date], [o0].[Enum], [o0].[Enums], [o0].[Fraction], [o0].[NullableEnum], [o0].[NullableEnums] +ORDER BY [j].[Id], [o0].[Date], [o0].[Enum], [o0].[Enums], [o0].[Fraction], [o0].[Id0], [o0].[NullableEnum], [o0].[NullableEnums] """); } @@ -1556,7 +1487,7 @@ public override async Task Json_leaf_collection_distinct_and_other_collection(bo FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT DISTINCT [j].[Id], [o].[SomethingSomething] - FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedReferenceBranch.OwnedCollectionLeaf') WITH ([SomethingSomething] nvarchar(max) '$.SomethingSomething') AS [o] + FROM OPENJSON([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedCollectionLeaf') WITH ([SomethingSomething] nvarchar(max) '$.SomethingSomething') AS [o] ) AS [o0] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] ORDER BY [j].[Id], [o0].[SomethingSomething] @@ -1605,10 +1536,7 @@ FROM OPENJSON(CAST([j].[OwnedReferenceRoot] AS nvarchar(max)), '$.OwnedReference public override async Task Json_collection_of_primitives_SelectMany(bool async) { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "OpenJson support not yet supported for JSON native data type.", - (await Assert.ThrowsAsync(() => base.Json_collection_of_primitives_SelectMany(async))).Message); + await base.Json_collection_of_primitives_SelectMany(async); AssertSql( """ @@ -1626,7 +1554,7 @@ public override async Task Json_collection_of_primitives_index_used_in_predicate """ SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedReferenceRoot], '$.Names[0]') = N'e1_r1' +WHERE JSON_VALUE([j].[OwnedReferenceRoot], '$.Names[0]' RETURNING nvarchar(max)) = N'e1_r1' """); } @@ -1636,7 +1564,7 @@ public override async Task Json_collection_of_primitives_index_used_in_projectio AssertSql( """ -SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Enums[0]') AS int) +SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.Enums[0]' RETURNING int) FROM [JsonEntitiesBasic] AS [j] ORDER BY [j].[Id] """); @@ -1650,16 +1578,13 @@ public override async Task Json_collection_of_primitives_index_used_in_orderby(b """ SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] -ORDER BY CAST(JSON_VALUE([j].[OwnedReferenceRoot], '$.Numbers[0]') AS int) +ORDER BY JSON_VALUE([j].[OwnedReferenceRoot], '$.Numbers[0]' RETURNING int) """); } public override async Task Json_collection_of_primitives_contains_in_predicate(bool async) { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "OpenJson support not yet supported for JSON native data type.", - (await Assert.ThrowsAsync(() => base.Json_collection_of_primitives_contains_in_predicate(async))).Message); + await base.Json_collection_of_primitives_contains_in_predicate(async); AssertSql( """ @@ -1683,7 +1608,7 @@ public override async Task Json_collection_index_with_parameter_Select_ElementAt SELECT [j].[Id], ( SELECT N'Foo' - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$[' + CAST(@prm AS nvarchar(max)) + '].OwnedCollectionBranch') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$[' + CAST(@prm AS nvarchar(max)) + '].OwnedCollectionBranch') AS [o] ORDER BY CAST([o].[key] AS int) OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) AS [CollectionElement] FROM [JsonEntitiesBasic] AS [j] @@ -1699,7 +1624,7 @@ public override async Task Json_collection_index_with_expression_Select_ElementA """ @prm='0' -SELECT JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@prm + [j].[Id] AS nvarchar(max)) + '].OwnedCollectionBranch[0].OwnedReferenceLeaf.SomethingSomething') +SELECT JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@prm + [j].[Id] AS nvarchar(max)) + '].OwnedCollectionBranch[0].OwnedReferenceLeaf.SomethingSomething' RETURNING nvarchar(max)) FROM [JsonEntitiesBasic] AS [j] """); } @@ -1736,7 +1661,7 @@ public override async Task Json_collection_Select_entity_in_anonymous_object_Ele FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT JSON_QUERY([o].[value], '$.OwnedReferenceBranch') AS [c], [j].[Id], 1 AS [c0] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] ORDER BY CAST([o].[key] AS int) OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY ) AS [o0] @@ -1754,7 +1679,7 @@ public override async Task Json_collection_Select_entity_with_initializer_Elemen FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT [j].[Id], 1 AS [c] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] ORDER BY CAST([o].[key] AS int) OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY ) AS [o0] @@ -1986,7 +1911,7 @@ public override async Task Json_scalar_required_null_semantics(bool async) """ SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot], '$.Number') AS int) <> CAST(LEN(JSON_VALUE([j].[OwnedReferenceRoot], '$.Name')) AS int) OR JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') IS NULL +WHERE JSON_VALUE([j].[OwnedReferenceRoot], '$.Number' RETURNING int) <> CAST(LEN(JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max))) AS int) OR JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) IS NULL """); } @@ -1998,7 +1923,7 @@ public override async Task Json_scalar_optional_null_semantics(bool async) """ SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE (JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') <> JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') OR JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') IS NULL OR JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') IS NULL) AND (JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') IS NOT NULL OR JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') IS NOT NULL) +WHERE (JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) <> JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething' RETURNING nvarchar(max)) OR JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) IS NULL OR JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething' RETURNING nvarchar(max)) IS NULL) AND (JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) IS NOT NULL OR JSON_VALUE([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething' RETURNING nvarchar(max)) IS NOT NULL) """); } @@ -2010,7 +1935,7 @@ public override async Task Group_by_on_json_scalar(bool async) """ SELECT [j0].[Key], COUNT(*) AS [Count] FROM ( - SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j] ) AS [j0] GROUP BY [j0].[Key] @@ -2025,7 +1950,7 @@ public override async Task Group_by_on_json_scalar_using_collection_indexer(bool """ SELECT [j0].[Key], COUNT(*) AS [Count] FROM ( - SELECT JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') AS [Key] + SELECT JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j] ) AS [j0] GROUP BY [j0].[Key] @@ -2042,7 +1967,7 @@ public override async Task Group_by_First_on_json_scalar(bool async) FROM ( SELECT [j0].[Key] FROM ( - SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j] ) AS [j0] GROUP BY [j0].[Key] @@ -2052,7 +1977,7 @@ LEFT JOIN ( FROM ( SELECT [j1].[Id], [j1].[EntityBasicId], [j1].[Name], [j1].[c] AS [c], [j1].[c0] AS [c0], [j1].[Key], ROW_NUMBER() OVER(PARTITION BY [j1].[Key] ORDER BY [j1].[Id]) AS [row] FROM ( - SELECT [j2].[Id], [j2].[EntityBasicId], [j2].[Name], [j2].[OwnedCollectionRoot] AS [c], [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT [j2].[Id], [j2].[EntityBasicId], [j2].[Name], [j2].[OwnedCollectionRoot] AS [c], [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j2] ) AS [j1] ) AS [j4] @@ -2071,7 +1996,7 @@ public override async Task Group_by_FirstOrDefault_on_json_scalar(bool async) FROM ( SELECT [j0].[Key] FROM ( - SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j] ) AS [j0] GROUP BY [j0].[Key] @@ -2081,7 +2006,7 @@ LEFT JOIN ( FROM ( SELECT [j1].[Id], [j1].[EntityBasicId], [j1].[Name], [j1].[c] AS [c], [j1].[c0] AS [c0], [j1].[Key], ROW_NUMBER() OVER(PARTITION BY [j1].[Key] ORDER BY [j1].[Id]) AS [row] FROM ( - SELECT [j2].[Id], [j2].[EntityBasicId], [j2].[Name], [j2].[OwnedCollectionRoot] AS [c], [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT [j2].[Id], [j2].[EntityBasicId], [j2].[Name], [j2].[OwnedCollectionRoot] AS [c], [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j2] ) AS [j1] ) AS [j4] @@ -2092,17 +2017,7 @@ FROM [JsonEntitiesBasic] AS [j2] public override async Task Group_by_Skip_Take_on_json_scalar(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) - if (async) - { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.Group_by_Skip_Take_on_json_scalar(true))).Message); - } - else - { - await base.Group_by_Skip_Take_on_json_scalar(false); - } + await base.Group_by_Skip_Take_on_json_scalar(async); AssertSql( """ @@ -2110,7 +2025,7 @@ public override async Task Group_by_Skip_Take_on_json_scalar(bool async) FROM ( SELECT [j0].[Key] FROM ( - SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j] ) AS [j0] GROUP BY [j0].[Key] @@ -2120,7 +2035,7 @@ LEFT JOIN ( FROM ( SELECT [j1].[Id], [j1].[EntityBasicId], [j1].[Name], [j1].[c] AS [c], [j1].[c0] AS [c0], [j1].[Key], ROW_NUMBER() OVER(PARTITION BY [j1].[Key] ORDER BY [j1].[Id]) AS [row] FROM ( - SELECT [j2].[Id], [j2].[EntityBasicId], [j2].[Name], [j2].[OwnedCollectionRoot] AS [c], [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT [j2].[Id], [j2].[EntityBasicId], [j2].[Name], [j2].[OwnedCollectionRoot] AS [c], [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j2] ) AS [j1] ) AS [j4] @@ -2145,14 +2060,14 @@ public override async Task Group_by_json_scalar_Skip_First_project_json_scalar(b AssertSql( """ SELECT ( - SELECT TOP(1) CAST(JSON_VALUE([j1].[c0], '$.OwnedReferenceBranch.Enum') AS int) + SELECT TOP(1) JSON_VALUE([j1].[c0], '$.OwnedReferenceBranch.Enum' RETURNING int) FROM ( - SELECT [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT [j2].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j2].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j2] ) AS [j1] WHERE [j0].[Key] = [j1].[Key] OR ([j0].[Key] IS NULL AND [j1].[Key] IS NULL)) FROM ( - SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name') AS [Key] + SELECT JSON_VALUE([j].[OwnedReferenceRoot], '$.Name' RETURNING nvarchar(max)) AS [Key] FROM [JsonEntitiesBasic] AS [j] ) AS [j0] GROUP BY [j0].[Key] @@ -2346,6 +2261,7 @@ FROM [JsonEntitiesAllTypes] AS [j] """); } + [ConditionalTheory(Skip = "#36627")] public override async Task Json_all_types_projection_individual_properties(bool async) { await base.Json_all_types_projection_individual_properties(async); @@ -2365,7 +2281,7 @@ public override async Task Json_boolean_predicate(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestBoolean') AS bit) = CAST(1 AS bit) +WHERE JSON_VALUE([j].[Reference], '$.TestBoolean' RETURNING bit) = CAST(1 AS bit) """); } @@ -2377,7 +2293,7 @@ public override async Task Json_boolean_predicate_negated(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestBoolean') AS bit) = CAST(0 AS bit) +WHERE JSON_VALUE([j].[Reference], '$.TestBoolean' RETURNING bit) = CAST(0 AS bit) """); } @@ -2387,7 +2303,7 @@ public override async Task Json_boolean_projection(bool async) AssertSql( """ -SELECT CAST(JSON_VALUE([j].[Reference], '$.TestBoolean') AS bit) +SELECT JSON_VALUE([j].[Reference], '$.TestBoolean' RETURNING bit) FROM [JsonEntitiesAllTypes] AS [j] """); } @@ -2398,7 +2314,7 @@ public override async Task Json_boolean_projection_negated(bool async) AssertSql( """ -SELECT ~CAST(JSON_VALUE([j].[Reference], '$.TestBoolean') AS bit) +SELECT ~JSON_VALUE([j].[Reference], '$.TestBoolean' RETURNING bit) FROM [JsonEntitiesAllTypes] AS [j] """); } @@ -2411,7 +2327,7 @@ public override async Task Json_predicate_on_default_string(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestDefaultString') <> N'MyDefaultStringInReference1' OR JSON_VALUE([j].[Reference], '$.TestDefaultString') IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestDefaultString' RETURNING nvarchar(max)) <> N'MyDefaultStringInReference1' OR JSON_VALUE([j].[Reference], '$.TestDefaultString' RETURNING nvarchar(max)) IS NULL """); } @@ -2423,7 +2339,7 @@ public override async Task Json_predicate_on_max_length_string(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestMaxLengthString') <> N'Foo' OR JSON_VALUE([j].[Reference], '$.TestMaxLengthString') IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestMaxLengthString' RETURNING nvarchar(5)) <> N'Foo' OR JSON_VALUE([j].[Reference], '$.TestMaxLengthString' RETURNING nvarchar(5)) IS NULL """); } @@ -2436,8 +2352,8 @@ public override async Task Json_predicate_on_string_condition(bool async) SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE CASE - WHEN CAST(JSON_VALUE([j].[Reference], '$.TestBoolean') AS bit) = CAST(0 AS bit) THEN JSON_VALUE([j].[Reference], '$.TestMaxLengthString') - ELSE JSON_VALUE([j].[Reference], '$.TestDefaultString') + WHEN JSON_VALUE([j].[Reference], '$.TestBoolean' RETURNING bit) = CAST(0 AS bit) THEN JSON_VALUE([j].[Reference], '$.TestMaxLengthString' RETURNING nvarchar(5)) + ELSE JSON_VALUE([j].[Reference], '$.TestDefaultString' RETURNING nvarchar(max)) END = N'MyDefaultStringInReference1' """); } @@ -2450,16 +2366,13 @@ public override async Task Json_predicate_on_byte(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestByte') AS tinyint) <> CAST(3 AS tinyint) OR CAST(JSON_VALUE([j].[Reference], '$.TestByte') AS tinyint) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestByte' RETURNING tinyint) <> CAST(3 AS tinyint) OR JSON_VALUE([j].[Reference], '$.TestByte' RETURNING tinyint) IS NULL """); } public override async Task Json_predicate_on_byte_array(bool async) { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "OpenJson support not yet supported for JSON native data type.", - (await Assert.ThrowsAsync(() => base.Json_predicate_on_byte_array(async))).Message); + await base.Json_predicate_on_byte_array(async); AssertSql( """ @@ -2478,7 +2391,7 @@ public override async Task Json_predicate_on_character(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestCharacter') <> N'z' OR JSON_VALUE([j].[Reference], '$.TestCharacter') IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestCharacter' RETURNING nvarchar(1)) <> N'z' OR JSON_VALUE([j].[Reference], '$.TestCharacter' RETURNING nvarchar(1)) IS NULL """); } @@ -2490,7 +2403,7 @@ public override async Task Json_predicate_on_datetime(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateTime') AS datetime2) <> '2000-01-03T00:00:00.0000000' OR CAST(JSON_VALUE([j].[Reference], '$.TestDateTime') AS datetime2) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestDateTime' RETURNING datetime2) <> '2000-01-03T00:00:00.0000000' OR JSON_VALUE([j].[Reference], '$.TestDateTime' RETURNING datetime2) IS NULL """); } @@ -2502,7 +2415,7 @@ public override async Task Json_predicate_on_datetimeoffset(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateTimeOffset') AS datetimeoffset) <> '2000-01-04T00:00:00.0000000+03:02' OR CAST(JSON_VALUE([j].[Reference], '$.TestDateTimeOffset') AS datetimeoffset) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestDateTimeOffset' RETURNING datetimeoffset) <> '2000-01-04T00:00:00.0000000+03:02' OR JSON_VALUE([j].[Reference], '$.TestDateTimeOffset' RETURNING datetimeoffset) IS NULL """); } @@ -2514,7 +2427,7 @@ public override async Task Json_predicate_on_decimal(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDecimal') AS decimal(18,3)) <> 1.35 OR CAST(JSON_VALUE([j].[Reference], '$.TestDecimal') AS decimal(18,3)) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestDecimal' RETURNING decimal(18,3)) <> 1.35 OR JSON_VALUE([j].[Reference], '$.TestDecimal' RETURNING decimal(18,3)) IS NULL """); } @@ -2526,7 +2439,7 @@ public override async Task Json_predicate_on_double(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDouble') AS float) <> 33.25E0 OR CAST(JSON_VALUE([j].[Reference], '$.TestDouble') AS float) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestDouble' RETURNING float) <> 33.25E0 OR JSON_VALUE([j].[Reference], '$.TestDouble' RETURNING float) IS NULL """); } @@ -2538,7 +2451,7 @@ public override async Task Json_predicate_on_enum(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestEnum') AS int) <> 2 OR CAST(JSON_VALUE([j].[Reference], '$.TestEnum') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestEnum' RETURNING int) <> 2 OR JSON_VALUE([j].[Reference], '$.TestEnum' RETURNING int) IS NULL """); } @@ -2550,10 +2463,11 @@ public override async Task Json_predicate_on_enumwithintconverter(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter') AS int) <> -3 OR CAST(JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter' RETURNING int) <> -3 OR JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter' RETURNING int) IS NULL """); } + [ConditionalTheory(Skip = "#36627")] public override async Task Json_predicate_on_guid(bool async) { await base.Json_predicate_on_guid(async); @@ -2574,7 +2488,7 @@ public override async Task Json_predicate_on_int16(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt16') AS smallint) <> CAST(3 AS smallint) OR CAST(JSON_VALUE([j].[Reference], '$.TestInt16') AS smallint) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestInt16' RETURNING smallint) <> CAST(3 AS smallint) OR JSON_VALUE([j].[Reference], '$.TestInt16' RETURNING smallint) IS NULL """); } @@ -2586,7 +2500,7 @@ public override async Task Json_predicate_on_int32(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt32') AS int) <> 33 OR CAST(JSON_VALUE([j].[Reference], '$.TestInt32') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestInt32' RETURNING int) <> 33 OR JSON_VALUE([j].[Reference], '$.TestInt32' RETURNING int) IS NULL """); } @@ -2598,7 +2512,7 @@ public override async Task Json_predicate_on_int64(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt64') AS bigint) <> CAST(333 AS bigint) OR CAST(JSON_VALUE([j].[Reference], '$.TestInt64') AS bigint) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestInt64' RETURNING bigint) <> CAST(333 AS bigint) OR JSON_VALUE([j].[Reference], '$.TestInt64' RETURNING bigint) IS NULL """); } @@ -2610,7 +2524,7 @@ public override async Task Json_predicate_on_nullableenum1(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnum') AS int) <> -1 OR CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnum') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnum' RETURNING int) <> -1 OR JSON_VALUE([j].[Reference], '$.TestNullableEnum' RETURNING int) IS NULL """); } @@ -2622,7 +2536,7 @@ public override async Task Json_predicate_on_nullableenum2(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnum') AS int) IS NOT NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnum' RETURNING int) IS NOT NULL """); } @@ -2634,7 +2548,7 @@ public override async Task Json_predicate_on_nullableenumwithconverter1(bool asy """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) <> 2 OR CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter' RETURNING int) <> 2 OR JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter' RETURNING int) IS NULL """); } @@ -2646,7 +2560,7 @@ public override async Task Json_predicate_on_nullableenumwithconverter2(bool asy """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) IS NOT NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter' RETURNING int) IS NOT NULL """); } @@ -2658,7 +2572,7 @@ public override async Task Json_predicate_on_nullableenumwithconverterthathandle """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls') <> N'One' OR JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls') IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls' RETURNING nvarchar(max)) <> N'One' OR JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls' RETURNING nvarchar(max)) IS NULL """); } @@ -2680,7 +2594,7 @@ public override async Task Json_predicate_on_nullableint321(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) <> 100 OR CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableInt32' RETURNING int) <> 100 OR JSON_VALUE([j].[Reference], '$.TestNullableInt32' RETURNING int) IS NULL """); } @@ -2692,7 +2606,7 @@ public override async Task Json_predicate_on_nullableint322(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) IS NOT NULL +WHERE JSON_VALUE([j].[Reference], '$.TestNullableInt32' RETURNING int) IS NOT NULL """); } @@ -2704,7 +2618,7 @@ public override async Task Json_predicate_on_signedbyte(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestSignedByte') AS smallint) <> CAST(100 AS smallint) OR CAST(JSON_VALUE([j].[Reference], '$.TestSignedByte') AS smallint) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestSignedByte' RETURNING smallint) <> CAST(100 AS smallint) OR JSON_VALUE([j].[Reference], '$.TestSignedByte' RETURNING smallint) IS NULL """); } @@ -2716,7 +2630,7 @@ public override async Task Json_predicate_on_single(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestSingle') AS real) <> CAST(10.4 AS real) OR CAST(JSON_VALUE([j].[Reference], '$.TestSingle') AS real) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestSingle' RETURNING real) <> CAST(10.4 AS real) OR JSON_VALUE([j].[Reference], '$.TestSingle' RETURNING real) IS NULL """); } @@ -2728,7 +2642,7 @@ public override async Task Json_predicate_on_timespan(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestTimeSpan') AS time) <> '03:02:00' OR CAST(JSON_VALUE([j].[Reference], '$.TestTimeSpan') AS time) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestTimeSpan' RETURNING time) <> '03:02:00' OR JSON_VALUE([j].[Reference], '$.TestTimeSpan' RETURNING time) IS NULL """); } @@ -2740,7 +2654,7 @@ public override async Task Json_predicate_on_dateonly(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateOnly') AS date) <> '0003-02-01' OR CAST(JSON_VALUE([j].[Reference], '$.TestDateOnly') AS date) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestDateOnly' RETURNING date) <> '0003-02-01' OR JSON_VALUE([j].[Reference], '$.TestDateOnly' RETURNING date) IS NULL """); } @@ -2752,7 +2666,7 @@ public override async Task Json_predicate_on_timeonly(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestTimeOnly') AS time) <> '03:02:00' OR CAST(JSON_VALUE([j].[Reference], '$.TestTimeOnly') AS time) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestTimeOnly' RETURNING time) <> '03:02:00' OR JSON_VALUE([j].[Reference], '$.TestTimeOnly' RETURNING time) IS NULL """); } @@ -2764,7 +2678,7 @@ public override async Task Json_predicate_on_unisgnedint16(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt16') AS int) <> 100 OR CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt16') AS int) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestUnsignedInt16' RETURNING int) <> 100 OR JSON_VALUE([j].[Reference], '$.TestUnsignedInt16' RETURNING int) IS NULL """); } @@ -2776,7 +2690,7 @@ public override async Task Json_predicate_on_unsignedint32(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt32') AS bigint) <> CAST(1000 AS bigint) OR CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt32') AS bigint) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestUnsignedInt32' RETURNING bigint) <> CAST(1000 AS bigint) OR JSON_VALUE([j].[Reference], '$.TestUnsignedInt32' RETURNING bigint) IS NULL """); } @@ -2788,7 +2702,7 @@ public override async Task Json_predicate_on_unsignedint64(bool async) """ SELECT [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt64') AS decimal(20,0)) <> 10000.0 OR CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt64') AS decimal(20,0)) IS NULL +WHERE JSON_VALUE([j].[Reference], '$.TestUnsignedInt64' RETURNING decimal(20,0)) <> 10000.0 OR JSON_VALUE([j].[Reference], '$.TestUnsignedInt64' RETURNING decimal(20,0)) IS NULL """); } @@ -2800,7 +2714,7 @@ public override async Task Json_predicate_on_bool_converted_to_int_zero_one(bool """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.BoolConvertedToIntZeroOne') AS int) = 1 +WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToIntZeroOne' RETURNING int) = 1 """); } @@ -2812,7 +2726,7 @@ public override async Task Json_predicate_on_bool_converted_to_int_zero_one_with """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.BoolConvertedToIntZeroOne') AS int) = 0 +WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToIntZeroOne' RETURNING int) = 0 """); } @@ -2824,7 +2738,7 @@ public override async Task Json_predicate_on_bool_converted_to_string_True_False """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringTrueFalse') = N'True' +WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringTrueFalse' RETURNING nvarchar(5)) = N'True' """); } @@ -2836,7 +2750,7 @@ public override async Task Json_predicate_on_bool_converted_to_string_True_False """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringTrueFalse') = N'True' +WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringTrueFalse' RETURNING nvarchar(5)) = N'True' """); } @@ -2848,7 +2762,7 @@ public override async Task Json_predicate_on_bool_converted_to_string_Y_N(bool a """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringYN') = N'Y' +WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringYN' RETURNING nvarchar(1)) = N'Y' """); } @@ -2860,7 +2774,7 @@ public override async Task Json_predicate_on_bool_converted_to_string_Y_N_with_e """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringYN') = N'N' +WHERE JSON_VALUE([j].[Reference], '$.BoolConvertedToStringYN' RETURNING nvarchar(1)) = N'N' """); } @@ -2872,7 +2786,7 @@ public override async Task Json_predicate_on_int_zero_one_converted_to_bool(bool """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.IntZeroOneConvertedToBool') AS bit) = CAST(1 AS bit) +WHERE JSON_VALUE([j].[Reference], '$.IntZeroOneConvertedToBool' RETURNING bit) = CAST(1 AS bit) """); } @@ -2884,7 +2798,7 @@ public override async Task Json_predicate_on_string_True_False_converted_to_bool """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.StringTrueFalseConvertedToBool') AS bit) = CAST(0 AS bit) +WHERE JSON_VALUE([j].[Reference], '$.StringTrueFalseConvertedToBool' RETURNING bit) = CAST(0 AS bit) """); } @@ -2896,7 +2810,7 @@ public override async Task Json_predicate_on_string_Y_N_converted_to_bool(bool a """ SELECT [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.StringYNConvertedToBool') AS bit) = CAST(0 AS bit) +WHERE JSON_VALUE([j].[Reference], '$.StringYNConvertedToBool' RETURNING bit) = CAST(0 AS bit) """); } @@ -2962,19 +2876,13 @@ SELECT JSON_QUERY([m].[OwnedReferenceRoot], '$.OwnedCollectionBranch'), [m].[Id] public override async Task FromSql_on_entity_with_json_inheritance_on_base(bool async) { - // TODO:SQLJSON Returns empty (invalid) JSON (See BadJson.cs) if (async) { - Assert.Equal( - "Unable to cast object of type 'System.DBNull' to type 'System.String'.", - (await Assert.ThrowsAsync(() => base.FromSql_on_entity_with_json_inheritance_on_base(true))).Message); + await base.FromSql_on_entity_with_json_inheritance_on_base(true); } else { - Assert.Equal( - RelationalStrings.JsonEmptyString, - (await Assert.ThrowsAsync(() => base.FromSql_on_entity_with_json_inheritance_on_base(false))) - .Message); + await base.FromSql_on_entity_with_json_inheritance_on_base(false); } AssertSql( @@ -3062,8 +2970,8 @@ public override async Task Json_nested_collection_anonymous_projection_of_primit FROM [JsonEntitiesBasic] AS [j] OUTER APPLY ( SELECT [o].[key], CAST(JSON_VALUE([o0].[value], '$.Date') AS datetime2) AS [c], CAST(JSON_VALUE([o0].[value], '$.Enum') AS int) AS [c0], JSON_QUERY([o0].[value], '$.Enums') AS [c1], CAST(JSON_VALUE([o0].[value], '$.Fraction') AS decimal(18,2)) AS [c2], [o0].[key] AS [key0], CAST([o].[key] AS int) AS [c3], CAST([o0].[key] AS int) AS [c4] - FROM OPENJSON(CAST([j].[OwnedCollectionRoot] AS nvarchar(max)), '$') AS [o] - OUTER APPLY OPENJSON(CAST(JSON_QUERY([o].[value], '$.OwnedCollectionBranch') AS nvarchar(max)), '$') AS [o0] + FROM OPENJSON([j].[OwnedCollectionRoot], '$') AS [o] + OUTER APPLY OPENJSON(JSON_QUERY([o].[value], '$.OwnedCollectionBranch'), '$') AS [o0] ) AS [s] ORDER BY [j].[Id], [s].[c3], [s].[key], [s].[c4] """); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServer160Test.cs index 343af0a06e0..5adfc86600b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServer160Test.cs @@ -1375,6 +1375,9 @@ private void AssertSql(params string[] expected) public class Fixture160 : NorthwindQuerySqlServerFixture { public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(b => b.UseCompatibilityLevel(160)); + { + var options = base.AddOptions(builder); + return options.UseSqlServerCompatibilityLevel(160); + } } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServer160Test.cs index 83b8a6ae474..be057ce8786 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServer160Test.cs @@ -225,6 +225,6 @@ protected override void ClearLog() public class Fixture160 : NorthwindQuerySqlServerFixture { public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(b => b.UseCompatibilityLevel(160)); + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(160); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledSqlPregenerationQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledSqlPregenerationQuerySqlServerTest.cs index 672449555e3..9ad3fe1ed22 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledSqlPregenerationQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledSqlPregenerationQuerySqlServerTest.cs @@ -254,16 +254,9 @@ protected override ITestStoreFactory TestStoreFactory => SqlServerTestStoreFactory.Instance; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - { - builder = base.AddOptions(builder); - // TODO: Figure out if there's a nice way to continue using the retrying strategy - var sqlServerOptionsBuilder = new SqlServerDbContextOptionsBuilder(builder); - sqlServerOptionsBuilder - .UseCompatibilityLevel(120) - .ExecutionStrategy(d => new NonRetryingExecutionStrategy(d)); - return builder; - } + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(120) + .ConfigureSqlEngine(b => b.ExecutionStrategy(d => new NonRetryingExecutionStrategy(d))); public override PrecompiledQueryTestHelpers PrecompiledQueryTestHelpers => SqlServerPrecompiledQueryTestHelpers.Instance; diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs index 52d1624599e..6f3d948549f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs @@ -1542,6 +1542,6 @@ protected override ITestStoreFactory TestStoreFactory // Compatibility level 120 (SQL Server 2014) doesn't support OPENJSON public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(o => o.UseCompatibilityLevel(120)); + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(120); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs index c11fb0aac04..694958227be 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs @@ -2261,7 +2261,7 @@ protected override ITestStoreFactory TestStoreFactory => SqlServerTestStoreFactory.Instance; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(b => b.UseCompatibilityLevel(160)); + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(160); protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs index 1799e38a4c1..d279073a0ad 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs @@ -90,7 +90,7 @@ public override async Task Parameter_collection_Count_with_column_predicate_with FROM [PrimitiveCollectionsEntity] AS [p] WHERE ( SELECT COUNT(*) - FROM (VALUES (2), (999), (1000)) AS [i]([Value]) + FROM (VALUES (CAST(2 AS int)), (999), (1000)) AS [i]([Value]) WHERE [i].[Value] > [p].[Id]) = 2 """); } @@ -1130,7 +1130,7 @@ public override async Task Column_collection_index_int() """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE CAST(JSON_VALUE([p].[Ints], '$[1]') AS int) = 10 +WHERE JSON_VALUE([p].[Ints], '$[1]' RETURNING int) = 10 """); } @@ -1142,7 +1142,7 @@ public override async Task Column_collection_index_string() """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE JSON_VALUE([p].[Strings], '$[1]') = N'10' +WHERE JSON_VALUE([p].[Strings], '$[1]' RETURNING nvarchar(max)) = N'10' """); } @@ -1154,7 +1154,7 @@ public override async Task Column_collection_index_datetime() """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE CAST(JSON_VALUE([p].[DateTimes], '$[1]') AS datetime2) = '2020-01-10T12:30:00.0000000Z' +WHERE JSON_VALUE([p].[DateTimes], '$[1]' RETURNING datetime2) = '2020-01-10T12:30:00.0000000Z' """); } @@ -1166,7 +1166,7 @@ public override async Task Column_collection_index_beyond_end() """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE CAST(JSON_VALUE([p].[Ints], '$[999]') AS int) = 10 +WHERE JSON_VALUE([p].[Ints], '$[999]' RETURNING int) = 10 """); } @@ -1179,7 +1179,7 @@ public override async Task Nullable_reference_column_collection_index_equals_nul """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE JSON_VALUE([p].[NullableStrings], '$[2]') = [p].[NullableString] OR (JSON_VALUE([p].[NullableStrings], '$[2]') IS NULL AND [p].[NullableString] IS NULL) +WHERE JSON_VALUE([p].[NullableStrings], '$[2]' RETURNING nvarchar(max)) = [p].[NullableString] OR (JSON_VALUE([p].[NullableStrings], '$[2]' RETURNING nvarchar(max)) IS NULL AND [p].[NullableString] IS NULL) """); } @@ -1193,7 +1193,7 @@ public override async Task Non_nullable_reference_column_collection_index_equals FROM [PrimitiveCollectionsEntity] AS [p] WHERE EXISTS ( SELECT 1 - FROM OPENJSON([p].[Strings]) AS [s]) AND JSON_VALUE([p].[Strings], '$[1]') = [p].[NullableString] + FROM OPENJSON([p].[Strings]) AS [s]) AND JSON_VALUE([p].[Strings], '$[1]' RETURNING nvarchar(max)) = [p].[NullableString] """); } @@ -1221,11 +1221,7 @@ public override async Task Inline_collection_index_Column_with_EF_Constant() """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE ( - SELECT [i].[Value] - FROM (VALUES (0, CAST(1 AS int)), (1, 2), (2, 3)) AS [i]([_ord], [Value]) - ORDER BY [i].[_ord] - OFFSET [p].[Int] ROWS FETCH NEXT 1 ROWS ONLY) = 1 +WHERE CAST(JSON_VALUE(N'[1,2,3]', '$[' + CAST([p].[Int] AS nvarchar(max)) + ']') AS int) = 1 """); } @@ -1299,7 +1295,7 @@ public override async Task Column_collection_ElementAt() """ SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] FROM [PrimitiveCollectionsEntity] AS [p] -WHERE CAST(JSON_VALUE([p].[Ints], '$[1]') AS int) = 10 +WHERE JSON_VALUE([p].[Ints], '$[1]' RETURNING int) = 10 """); } @@ -1827,7 +1823,7 @@ SELECT COUNT(*) SELECT [i1].[Value] FROM ( SELECT [i].[Value] - FROM (VALUES (1, @ints1), (2, @ints2)) AS [i]([_ord], [Value]) + FROM (VALUES (0, @ints1), (1, @ints2)) AS [i]([_ord], [Value]) ORDER BY [i].[_ord] OFFSET 1 ROWS ) AS [i1] @@ -1917,7 +1913,7 @@ FROM [PrimitiveCollectionsEntity] AS [p] SELECT COUNT(*) FROM ( SELECT [i].[Value] AS [Value0] - FROM (VALUES (1, @ints1), (2, @ints2)) AS [i]([_ord], [Value]) + FROM (VALUES (0, @ints1), (1, @ints2)) AS [i]([_ord], [Value]) ORDER BY [i].[_ord] OFFSET 1 ROWS ) AS [i0] @@ -2147,7 +2143,7 @@ public override async Task Project_primitive_collections_element() AssertSql( """ -SELECT CAST(JSON_VALUE([p].[Ints], '$[0]') AS int) AS [Indexer], CAST(JSON_VALUE([p].[DateTimes], '$[0]') AS datetime2) AS [EnumerableElementAt], JSON_VALUE([p].[Strings], '$[1]') AS [QueryableElementAt] +SELECT JSON_VALUE([p].[Ints], '$[0]' RETURNING int) AS [Indexer], JSON_VALUE([p].[DateTimes], '$[0]' RETURNING datetime2) AS [EnumerableElementAt], JSON_VALUE([p].[Strings], '$[1]' RETURNING nvarchar(max)) AS [QueryableElementAt] FROM [PrimitiveCollectionsEntity] AS [p] WHERE [p].[Id] < 4 ORDER BY [p].[Id] @@ -2268,8 +2264,10 @@ protected override ITestStoreFactory TestStoreFactory => SqlServerTestStoreFactory.Instance; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder) - .UseSqlServer(b => b.UseCompatibilityLevel(160)); + { + var options = base.AddOptions(builder); + return options.UseSqlServerCompatibilityLevel(160); + } protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionSqlServerTest.cs index 7fc083012c0..4eeba50facc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionSqlServerTest.cs @@ -126,7 +126,7 @@ public override async Task Index_constant() """ SELECT [r].[Id], [r].[Name], [r].[OptionalRelated], [r].[RelatedCollection], [r].[RequiredRelated] FROM [RootEntity] AS [r] -WHERE JSON_VALUE([r].[RelatedCollection], '$[0]' RETURNING int) = 8 +WHERE JSON_VALUE([r].[RelatedCollection], '$[0].Int' RETURNING int) = 8 """); } else @@ -152,7 +152,7 @@ public override async Task Index_parameter() SELECT [r].[Id], [r].[Name], [r].[OptionalRelated], [r].[RelatedCollection], [r].[RequiredRelated] FROM [RootEntity] AS [r] -WHERE JSON_VALUE([r].[RelatedCollection], '$[' + CAST(@i AS nvarchar(max)) + ']' RETURNING int) = 8 +WHERE JSON_VALUE([r].[RelatedCollection], '$[' + CAST(@i AS nvarchar(max)) + '].Int' RETURNING int) = 8 """); } else @@ -178,7 +178,7 @@ public override async Task Index_column() """ SELECT [r].[Id], [r].[Name], [r].[OptionalRelated], [r].[RelatedCollection], [r].[RequiredRelated] FROM [RootEntity] AS [r] -WHERE JSON_VALUE([r].[RelatedCollection], '$[' + CAST([r].[Id] - 1 AS nvarchar(max)) + ']' RETURNING int) = 8 +WHERE JSON_VALUE([r].[RelatedCollection], '$[' + CAST([r].[Id] - 1 AS nvarchar(max)) + '].Int' RETURNING int) = 8 """); } else @@ -202,7 +202,7 @@ public override async Task Index_out_of_bounds() """ SELECT [r].[Id], [r].[Name], [r].[OptionalRelated], [r].[RelatedCollection], [r].[RequiredRelated] FROM [RootEntity] AS [r] -WHERE JSON_VALUE([r].[RelatedCollection], '$[9999]' RETURNING int) = 8 +WHERE JSON_VALUE([r].[RelatedCollection], '$[9999].Int' RETURNING int) = 8 """); } else diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSqlServerFixture.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSqlServerFixture.cs index 875d699b382..775292151c9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSqlServerFixture.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSqlServerFixture.cs @@ -10,9 +10,12 @@ protected override ITestStoreFactory TestStoreFactory // When testing against SQL Server 2025 or later, set the compatibility level to 170 to use the json type instead of nvarchar(max). public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => TestEnvironment.SqlServerMajorVersion >= 17 - ? builder.UseSqlServer(o => o.UseCompatibilityLevel(170)) - : builder; + { + var options = base.AddOptions(builder); + return TestEnvironment.SqlServerMajorVersion < 17 + ? options + : options.UseSqlServerCompatibilityLevel(170); + } public virtual bool UsingJsonType => TestEnvironment.SqlServerMajorVersion >= 17; diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Translations/BasicTypesQuerySqlServerFixture.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Translations/BasicTypesQuerySqlServerFixture.cs index f02c4804a9f..433b3f0f1eb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Translations/BasicTypesQuerySqlServerFixture.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Translations/BasicTypesQuerySqlServerFixture.cs @@ -25,5 +25,5 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con public class BasicTypesQuerySqlServer160Fixture : BasicTypesQuerySqlServerFixture { public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).UseSqlServer(b => b.UseCompatibilityLevel(160)); + => base.AddOptions(builder).UseSqlServerCompatibilityLevel(160); } diff --git a/test/EFCore.SqlServer.FunctionalTests/SqlAzure/SqlAzureDatabaseCreationTest.cs b/test/EFCore.SqlServer.FunctionalTests/SqlAzure/SqlAzureDatabaseCreationTest.cs index 447deed2602..72dde696461 100644 --- a/test/EFCore.SqlServer.FunctionalTests/SqlAzure/SqlAzureDatabaseCreationTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/SqlAzure/SqlAzureDatabaseCreationTest.cs @@ -35,7 +35,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseSqlServer(_connectionString, b => b.ApplyConfiguration()); protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.HasPerformanceLevelSql("ELASTIC_POOL ( name = unicornhack )"); + => modelBuilder.HasPerformanceLevelSql($"ELASTIC_POOL ( name = {TestEnvironment.ElasticPoolName} )"); } [ConditionalFact] diff --git a/test/EFCore.SqlServer.FunctionalTests/SqlServerDatabaseCreatorTest.cs b/test/EFCore.SqlServer.FunctionalTests/SqlServerDatabaseCreatorTest.cs index 43f844e119b..802a829280e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/SqlServerDatabaseCreatorTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/SqlServerDatabaseCreatorTest.cs @@ -187,7 +187,7 @@ public Task Creates_schema_in_existing_database_with_filename(bool async, bool a => Creates_schema_in_existing_database_test(async, ambientTransaction, file: true); private static Task Creates_schema_in_existing_database_test(bool async, bool ambientTransaction, bool file) - => TestEnvironment.IsSqlAzure + => TestEnvironment.IsAzureSql ? new TestSqlServerRetryingExecutionStrategy().ExecuteAsync( (true, async, ambientTransaction, file), Creates_physical_database_and_schema_test) : Creates_physical_database_and_schema_test((true, async, ambientTransaction, file)); @@ -201,7 +201,7 @@ public Task Creates_physical_database_with_filename_and_schema(bool async, bool => Creates_new_physical_database_and_schema_test(async, ambientTransaction, file: true); private static Task Creates_new_physical_database_and_schema_test(bool async, bool ambientTransaction, bool file) - => TestEnvironment.IsSqlAzure + => TestEnvironment.IsAzureSql ? new TestSqlServerRetryingExecutionStrategy().ExecuteAsync( (false, async, ambientTransaction, file), Creates_physical_database_and_schema_test) : Creates_physical_database_and_schema_test((false, async, ambientTransaction, file)); diff --git a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerConditionAttribute.cs b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerConditionAttribute.cs index 1c5ec540b8f..c8652a5c20c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerConditionAttribute.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerConditionAttribute.cs @@ -27,12 +27,12 @@ public ValueTask IsMetAsync() if (Conditions.HasFlag(SqlServerCondition.IsAzureSql)) { - isMet &= TestEnvironment.IsSqlAzure; + isMet &= TestEnvironment.IsAzureSql; } if (Conditions.HasFlag(SqlServerCondition.IsNotAzureSql)) { - isMet &= !TestEnvironment.IsSqlAzure; + isMet &= !TestEnvironment.IsAzureSql; } if (Conditions.HasFlag(SqlServerCondition.SupportsAttach)) diff --git a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerDbContextOptionsBuilderExtensions.cs b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerDbContextOptionsBuilderExtensions.cs index 01998ce74f7..119389323dc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerDbContextOptionsBuilderExtensions.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerDbContextOptionsBuilderExtensions.cs @@ -55,4 +55,16 @@ public static AzureSynapseDbContextOptionsBuilder ApplyConfiguration(this AzureS return optionsBuilder; } + + /// + /// Configures the SQL Server or Azure SQL provider with the specified compatibility level. + /// This method automatically chooses between UseAzureSql and UseSqlServer based on the current test environment. + /// + /// The options builder to configure. + /// The compatibility level to use. + /// The configured options builder. + public static DbContextOptionsBuilder UseSqlServerCompatibilityLevel(this DbContextOptionsBuilder optionsBuilder, int compatibilityLevel) + => TestEnvironment.IsAzureSql + ? optionsBuilder.UseAzureSql(b => b.UseCompatibilityLevel(compatibilityLevel)) + : optionsBuilder.UseSqlServer(b => b.UseCompatibilityLevel(compatibilityLevel)); } diff --git a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerTestStore.cs b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerTestStore.cs index 219e99b11ef..9e72806800e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerTestStore.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerTestStore.cs @@ -116,8 +116,12 @@ protected override async Task InitializeAsync(Func createContext, Fun public override DbContextOptionsBuilder AddProviderOptions(DbContextOptionsBuilder builder) => (UseConnectionString - ? builder.UseSqlServer(ConnectionString, b => b.ApplyConfiguration()) - : builder.UseSqlServer(Connection, b => b.ApplyConfiguration())) + ? TestEnvironment.IsAzureSql + ? builder.UseAzureSql(ConnectionString, b => b.ApplyConfiguration()) + : builder.UseSqlServer(ConnectionString, b => b.ApplyConfiguration()) + : TestEnvironment.IsAzureSql + ? builder.UseAzureSql(Connection, b => b.ApplyConfiguration()) + : builder.UseSqlServer(Connection, b => b.ApplyConfiguration())) .ConfigureWarnings(b => b.Ignore(SqlServerEventId.SavepointsDisabledBecauseOfMARS)); private async Task CleanDatabaseAsync(Func? clean) @@ -213,7 +217,7 @@ private static string GetCreateDatabaseStatement(string name, string? fileName) { var result = $"CREATE DATABASE [{name}]"; - if (TestEnvironment.IsSqlAzure) + if (TestEnvironment.IsAzureSql) { var elasticGroupName = TestEnvironment.ElasticPoolName; result += Environment.NewLine @@ -450,7 +454,7 @@ public override async ValueTask DisposeAsync() await base.DisposeAsync(); if (_fileName != null // Clean up the database using a local file, as it might get deleted later - || (TestEnvironment.IsSqlAzure && !Shared)) + || (TestEnvironment.IsAzureSql && !Shared)) { await DeleteDatabaseAsync(); } diff --git a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestEnvironment.cs b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestEnvironment.cs index 085186e7dce..0ddd04640af 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestEnvironment.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestEnvironment.cs @@ -55,9 +55,11 @@ public static class TestEnvironment private static byte? _productMajorVersion; + private static int? _compatibilityLevel; + private static int? _engineEdition; - public static bool IsSqlAzure + public static bool IsAzureSql { get { @@ -136,7 +138,7 @@ public static bool IsHiddenColumnsSupported try { - _supportsHiddenColumns = (GetProductMajorVersion() >= 13 && GetEngineEdition() != 6) || IsSqlAzure; + _supportsHiddenColumns = ((GetProductMajorVersion() >= 13 && GetEngineEdition() != 6) || IsAzureSql) && GetCompatibilityLevel() >= 130; } catch (PlatformNotSupportedException) { @@ -190,7 +192,7 @@ public static bool IsOnlineIndexingSupported try { - _supportsOnlineIndexing = GetEngineEdition() == 3 || IsSqlAzure; + _supportsOnlineIndexing = GetEngineEdition() == 3 || IsAzureSql; } catch (PlatformNotSupportedException) { @@ -229,7 +231,7 @@ public static bool IsMemoryOptimizedTablesSupported using var command = new SqlCommand( "SELECT SERVERPROPERTY('IsXTPSupported');", sqlConnection); var result = command.ExecuteScalar(); - _supportsMemoryOptimizedTables = (result != null ? Convert.ToInt32(result) : 0) == 1 && !IsSqlAzure && !IsLocalDb; + _supportsMemoryOptimizedTables = (result != null ? Convert.ToInt32(result) : 0) == 1 && !IsLocalDb; } catch (PlatformNotSupportedException) { @@ -256,7 +258,7 @@ public static bool IsTemporalTablesCascadeDeleteSupported try { - _supportsTemporalTablesCascadeDelete = (GetProductMajorVersion() >= 14 /* && GetEngineEdition() != 6*/) || IsSqlAzure; + _supportsTemporalTablesCascadeDelete = (GetProductMajorVersion() >= 14 || IsAzureSql) && GetCompatibilityLevel() >= 140; } catch (PlatformNotSupportedException) { @@ -283,7 +285,7 @@ public static bool IsUtf8Supported try { - _supportsUtf8 = GetProductMajorVersion() >= 15 || IsSqlAzure; + _supportsUtf8 = (GetProductMajorVersion() >= 15 || IsAzureSql) && GetCompatibilityLevel() >= 150; } catch (PlatformNotSupportedException) { @@ -310,7 +312,7 @@ public static bool SupportsJsonPathExpressions try { - _supportsJsonPathExpressions = GetProductMajorVersion() >= 14 || IsSqlAzure; + _supportsJsonPathExpressions = (GetProductMajorVersion() >= 14 || IsAzureSql) && GetCompatibilityLevel() >= 140; } catch (PlatformNotSupportedException) { @@ -337,7 +339,7 @@ public static bool IsFunctions2017Supported try { - _supportsFunctions2017 = GetProductMajorVersion() >= 14 || IsSqlAzure; + _supportsFunctions2017 = (GetProductMajorVersion() >= 14 || IsAzureSql) && GetCompatibilityLevel() >= 140; } catch (PlatformNotSupportedException) { @@ -364,7 +366,7 @@ public static bool IsFunctions2019Supported try { - _supportsFunctions2019 = GetProductMajorVersion() >= 15 || IsSqlAzure; + _supportsFunctions2019 = (GetProductMajorVersion() >= 15 || IsAzureSql) && GetCompatibilityLevel() >= 150; } catch (PlatformNotSupportedException) { @@ -391,7 +393,7 @@ public static bool IsFunctions2022Supported try { - _supportsFunctions2022 = GetProductMajorVersion() >= 16 || IsSqlAzure; + _supportsFunctions2022 = (GetProductMajorVersion() >= 16 || IsAzureSql) && GetCompatibilityLevel() >= 160; } catch (PlatformNotSupportedException) { @@ -418,7 +420,7 @@ public static bool IsJsonTypeSupported try { - _isJsonTypeSupported = GetProductMajorVersion() >= 17 || IsSqlAzure; + _isJsonTypeSupported = (GetProductMajorVersion() >= 17 || IsAzureSql) && GetCompatibilityLevel() >= 170; } catch (PlatformNotSupportedException) { @@ -445,7 +447,8 @@ public static bool IsVectorTypeSupported try { - _isVectorTypeSupported = GetProductMajorVersion() >= 17 || IsSqlAzure; + _isVectorTypeSupported = ((!IsLocalDb && GetProductMajorVersion() >= 17) || IsAzureSql) + && GetCompatibilityLevel() >= 170; } catch (PlatformNotSupportedException) { @@ -500,4 +503,21 @@ private static byte GetProductMajorVersion() return _productMajorVersion.Value; } + + private static int GetCompatibilityLevel() + { + if (_compatibilityLevel.HasValue) + { + return _compatibilityLevel.Value; + } + + using var sqlConnection = new SqlConnection(SqlServerTestStore.CreateConnectionString("master")); + sqlConnection.Open(); + + using var command = new SqlCommand( + "SELECT compatibility_level FROM sys.databases WHERE [name] = 'master';", sqlConnection); + _compatibilityLevel = (byte)command.ExecuteScalar(); + + return _compatibilityLevel.Value; + } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateJsonTypeSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateJsonTypeSqlServerTest.cs index b927d0da497..57c9f61dc65 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateJsonTypeSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateJsonTypeSqlServerTest.cs @@ -19,14 +19,11 @@ public virtual void Check_all_tests_overridden() public override async Task Add_element_to_json_collection_branch() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Add_element_to_json_collection_branch())).InnerException?.Message); + await base.Add_element_to_json_collection_branch(); AssertSql( """ -@p0='[{"Date":"2101-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":10.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}},{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}]' (Nullable = false) (Size = 789) +@p0='[{"Date":"2101-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":10.1,"Id":89,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"Id":90,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}},{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":77,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}]' (Nullable = false) (Size = 813) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -34,15 +31,17 @@ public override async Task Add_element_to_json_collection_branch() UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Add_element_to_json_collection_leaf() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Add_element_to_json_collection_leaf())).InnerException?.Message); + await base.Add_element_to_json_collection_leaf(); AssertSql( """ @@ -54,6 +53,11 @@ public override async Task Add_element_to_json_collection_leaf() UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch.OwnedCollectionLeaf', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } @@ -63,7 +67,7 @@ public override async Task Add_element_to_json_collection_on_derived() AssertSql( """ -@p0='[{"Date":"2221-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":221.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"d2_r_c1"},{"SomethingSomething":"d2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"d2_r_r"}},{"Date":"2222-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":222.1,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"d2_r_c1"},{"SomethingSomething":"d2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"d2_r_r"}},{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}]' (Nullable = false) (Size = 773) +@p0='[{"Date":"2221-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":221.1,"Id":104,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"d2_r_c1"},{"SomethingSomething":"d2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"d2_r_r"}},{"Date":"2222-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":222.1,"Id":105,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"d2_r_c1"},{"SomethingSomething":"d2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"d2_r_r"}},{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":77,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}]' (Nullable = false) (Size = 799) @p1='2' SET IMPLICIT_TRANSACTIONS OFF; @@ -86,7 +90,7 @@ public override async Task Add_element_to_json_collection_root() AssertSql( """ -@p0='[{"Name":"e1_c1","Names":["e1_c11","e1_c12"],"Number":11,"Numbers":[-1000,0,1000],"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c2_c1"},{"SomethingSomething":"e1_c1_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}],"OwnedReferenceBranch":{"Date":"2110-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":11.0,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Name":"e1_c2","Names":["e1_c21","e1_c22"],"Number":12,"Numbers":[-1001,0,1001],"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":12.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":12.2,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c2_c1"},{"SomethingSomething":"e1_c2_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c2_r"}}],"OwnedReferenceBranch":{"Date":"2120-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":12.0,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}},{"Name":"new Name","Names":null,"Number":142,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}]' (Nullable = false) (Size = 2268) +@p0='[{"Id":0,"Name":"e1_c1","Names":["e1_c11","e1_c12"],"Number":11,"Numbers":[-1000,0,1000],"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"Id":92,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"Id":93,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c2_c1"},{"SomethingSomething":"e1_c1_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}],"OwnedReferenceBranch":{"Date":"2110-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":11.0,"Id":91,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Id":0,"Name":"e1_c2","Names":["e1_c21","e1_c22"],"Number":12,"Numbers":[-1001,0,1001],"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":12.1,"Id":95,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":12.2,"Id":96,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c2_c1"},{"SomethingSomething":"e1_c2_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c2_r"}}],"OwnedReferenceBranch":{"Date":"2120-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":12.0,"Id":94,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}},{"Id":0,"Name":"new Name","Names":null,"Number":142,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":7,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}]' (Nullable = false) (Size = 2344) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -108,7 +112,7 @@ public override async Task Add_element_to_json_collection_root_null_navigations( AssertSql( """ -@p0='[{"Name":"e1_c1","Names":["e1_c11","e1_c12"],"Number":11,"Numbers":[-1000,0,1000],"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c2_c1"},{"SomethingSomething":"e1_c1_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}],"OwnedReferenceBranch":{"Date":"2110-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":11.0,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Name":"e1_c2","Names":["e1_c21","e1_c22"],"Number":12,"Numbers":[-1001,0,1001],"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":12.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":12.2,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c2_c1"},{"SomethingSomething":"e1_c2_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c2_r"}}],"OwnedReferenceBranch":{"Date":"2120-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":12.0,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}},{"Name":"new Name","Names":null,"Number":142,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":null}}]' (Nullable = false) (Size = 2191) +@p0='[{"Id":0,"Name":"e1_c1","Names":["e1_c11","e1_c12"],"Number":11,"Numbers":[-1000,0,1000],"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"Id":92,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"Id":93,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c2_c1"},{"SomethingSomething":"e1_c1_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}],"OwnedReferenceBranch":{"Date":"2110-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":11.0,"Id":91,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Id":0,"Name":"e1_c2","Names":["e1_c21","e1_c22"],"Number":12,"Numbers":[-1001,0,1001],"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":12.1,"Id":95,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":12.2,"Id":96,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c2_c1"},{"SomethingSomething":"e1_c2_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c2_r"}}],"OwnedReferenceBranch":{"Date":"2120-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":12.0,"Id":94,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}},{"Id":0,"Name":"new Name","Names":null,"Number":142,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":7,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":null}}]' (Nullable = false) (Size = 2267) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -130,7 +134,7 @@ public override async Task Add_entity_with_json() AssertSql( """ -@p0='{"Name":"RootName","Names":null,"Number":42,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}' (Nullable = false) (Size = 353) +@p0='{"Id":0,"Name":"RootName","Names":null,"Number":42,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":7,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}' (Nullable = false) (Size = 367) @p1='[]' (Nullable = false) (Size = 2) @p2='2' @p3=NULL (DbType = Int32) @@ -150,12 +154,11 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Add_entity_with_json_null_navigations() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() => base.Add_entity_with_json_null_navigations()); + await base.Add_entity_with_json_null_navigations(); AssertSql( """ -@p0='{"Name":"RootName","Names":null,"Number":42,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":null}}' (Nullable = false) (Size = 331) +@p0='{"Id":0,"Name":"RootName","Names":null,"Number":42,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":7,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":null}}' (Nullable = false) (Size = 345) @p1='2' @p2=NULL (DbType = Int32) @p3='NewEntity' (Size = 4000) @@ -174,19 +177,11 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Add_json_reference_leaf() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Add_json_reference_leaf())).InnerException?.Message); + await base.Add_json_reference_leaf(); AssertSql( """ -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] -FROM [JsonEntitiesBasic] AS [j] -""", - // - """ -@p0=NULL (Nullable = false) +@p0='{"SomethingSomething":"ss3"}' (Nullable = false) (Size = 28) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -194,22 +189,21 @@ FROM [JsonEntitiesBasic] AS [j] UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch[0].OwnedReferenceLeaf', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Add_json_reference_root() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() => base.Add_json_reference_root()); + await base.Add_json_reference_root(); AssertSql( """ -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] -FROM [JsonEntitiesBasic] AS [j] -""", - // - """ -@p0=NULL (Nullable = false) +@p0='{"Id":0,"Name":"RootName","Names":null,"Number":42,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":-3,"Enums":null,"Fraction":42.42,"Id":7,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}' (Nullable = false) (Size = 367) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -220,7 +214,7 @@ OUTPUT 1 """, // """ -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); } @@ -248,10 +242,7 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Delete_json_collection_branch() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Delete_json_collection_branch())).InnerException?.Message); + await base.Delete_json_collection_branch(); AssertSql( """ @@ -263,13 +254,17 @@ public override async Task Delete_json_collection_branch() UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Delete_json_collection_root() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() => base.Delete_json_collection_root()); + await base.Delete_json_collection_root(); AssertSql( """ @@ -291,10 +286,7 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Delete_json_reference_leaf() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Delete_json_reference_leaf())).InnerException?.Message); + await base.Delete_json_reference_leaf(); AssertSql( """ @@ -306,13 +298,17 @@ public override async Task Delete_json_reference_leaf() UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch.OwnedReferenceLeaf', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Delete_json_reference_root() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() => base.Delete_json_reference_root()); + await base.Delete_json_reference_root(); AssertSql( """ @@ -400,16 +396,12 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Edit_element_in_json_multiple_levels_partial_update() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_element_in_json_multiple_levels_partial_update())).InnerException - ?.Message); + await base.Edit_element_in_json_multiple_levels_partial_update(); AssertSql( """ -@p0='[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"...and another"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"yet another change"},{"SomethingSomething":"and another"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}]' (Nullable = false) (Size = 561) -@p1='{"Name":"edit","Names":["e1_r1","e1_r2"],"Number":10,"Numbers":[-2147483648,-1,0,1,2147483647],"OwnedCollectionBranch":[{"Date":"2101-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":10.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}}],"OwnedReferenceBranch":{"Date":"2111-11-11T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":10.0,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_r_r"}}}' (Nullable = false) (Size = 960) +@p0='[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"Id":92,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"...and another"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"Id":93,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"yet another change"},{"SomethingSomething":"and another"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}]' (Nullable = false) (Size = 577) +@p1='{"Id":0,"Name":"edit","Names":["e1_r1","e1_r2"],"Number":10,"Numbers":[-2147483648,-1,0,1,2147483647],"OwnedCollectionBranch":[{"Date":"2101-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":10.1,"Id":89,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"Id":90,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}}],"OwnedReferenceBranch":{"Date":"2111-11-11T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":10.0,"Id":88,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_r_r"}}}' (Nullable = false) (Size = 991) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -417,20 +409,21 @@ public override async Task Edit_element_in_json_multiple_levels_partial_update() UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[0].OwnedCollectionBranch', JSON_QUERY(@p0)), [OwnedReferenceRoot] = @p1 OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Edit_element_in_json_branch_collection_and_add_element_to_the_same_collection() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() - => base.Edit_element_in_json_branch_collection_and_add_element_to_the_same_collection())).InnerException?.Message); + await base.Edit_element_in_json_branch_collection_and_add_element_to_the_same_collection(); AssertSql( """ -@p0='[{"Date":"2101-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":4321.3,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}},{"Date":"2222-11-11T00:00:00","Enum":-3,"Enums":null,"Fraction":45.32,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":{"SomethingSomething":"cc"}}]' (Nullable = false) (Size = 735) +@p0='[{"Date":"2101-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":4321.3,"Id":89,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"Id":90,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}},{"Date":"2222-11-11T00:00:00","Enum":-3,"Enums":null,"Fraction":45.32,"Id":77,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":{"SomethingSomething":"cc"}}]' (Nullable = false) (Size = 759) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -438,16 +431,17 @@ public override async Task Edit_element_in_json_branch_collection_and_add_elemen UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Edit_two_elements_in_the_same_json_collection() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_two_elements_in_the_same_json_collection())).InnerException - ?.Message); + await base.Edit_two_elements_in_the_same_json_collection(); AssertSql( """ @@ -459,6 +453,11 @@ public override async Task Edit_two_elements_in_the_same_json_collection() UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch[0].OwnedCollectionLeaf', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } @@ -468,7 +467,7 @@ public override async Task Edit_two_elements_in_the_same_json_collection_at_the_ AssertSql( """ -@p0='[{"Name":"edit1","Names":["e1_c11","e1_c12"],"Number":11,"Numbers":[-1000,0,1000],"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c2_c1"},{"SomethingSomething":"e1_c1_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}],"OwnedReferenceBranch":{"Date":"2110-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":11.0,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Name":"edit2","Names":["e1_c21","e1_c22"],"Number":12,"Numbers":[-1001,0,1001],"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":12.1,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":12.2,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c2_c1"},{"SomethingSomething":"e1_c2_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c2_r"}}],"OwnedReferenceBranch":{"Date":"2120-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":12.0,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}}]' (Nullable = false) (Size = 1913) +@p0='[{"Id":0,"Name":"edit1","Names":["e1_c11","e1_c12"],"Number":11,"Numbers":[-1000,0,1000],"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":11.1,"Id":92,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":11.2,"Id":93,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c2_c1"},{"SomethingSomething":"e1_c1_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}],"OwnedReferenceBranch":{"Date":"2110-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":11.0,"Id":91,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Id":0,"Name":"edit2","Names":["e1_c21","e1_c22"],"Number":12,"Numbers":[-1001,0,1001],"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":2,"Enums":[-1,-1,2],"Fraction":12.1,"Id":95,"NullableEnum":-1,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":12.2,"Id":96,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c2_c1"},{"SomethingSomething":"e1_c2_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c2_r"}}],"OwnedReferenceBranch":{"Date":"2120-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":12.0,"Id":94,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}}]' (Nullable = false) (Size = 1975) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -486,15 +485,11 @@ FROM [JsonEntitiesBasic] AS [j] public override async Task Edit_collection_element_and_reference_at_once() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_collection_element_and_reference_at_once())).InnerException - ?.Message); + await base.Edit_collection_element_and_reference_at_once(); AssertSql( """ -@p0='{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"edit1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit2"}}' (Nullable = false) (Size = 262) +@p0='{"Date":"2102-01-01T00:00:00","Enum":-3,"Enums":[-1,-1,2],"Fraction":10.2,"Id":90,"NullableEnum":2,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"edit1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit2"}}' (Nullable = false) (Size = 270) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -502,6 +497,11 @@ public override async Task Edit_collection_element_and_reference_at_once() UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch[1]', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } @@ -672,8 +672,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_decimal() { - // TODO:SQLJSON Cannot insert decimal (See DecimalParameters.cs) - await Assert.ThrowsAsync(() => base.Edit_single_property_decimal()); + await base.Edit_single_property_decimal(); AssertSql( """ @@ -937,8 +936,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_uint64() { - // TODO:SQLJSON Cannot insert decimal (See DecimalParameters.cs) - await Assert.ThrowsAsync(() => base.Edit_single_property_uint64()); + await base.Edit_single_property_uint64(); AssertSql( """ @@ -986,10 +984,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_collection_of_string() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_string())).InnerException?.Message); + await base.Edit_single_property_collection_of_string(); AssertSql( """ @@ -1002,6 +997,11 @@ public override async Task Edit_single_property_collection_of_string() UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Names', JSON_QUERY(@p0)), [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.Names', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } @@ -1247,16 +1247,12 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_two_properties_on_same_entity_updates_the_entire_entity() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_two_properties_on_same_entity_updates_the_entire_entity())) - .InnerException?.Message); + await base.Edit_two_properties_on_same_entity_updates_the_entire_entity(); AssertSql( """ -@p0='{"TestBoolean":false,"TestBooleanCollection":[true,false],"TestByte":25,"TestByteArray":"","TestByteCollection":null,"TestCharacter":"h","TestCharacterCollection":["A","B","\u0022"],"TestDateOnly":"2323-04-03","TestDateOnlyCollection":["3234-01-23","4331-01-21"],"TestDateTime":"2100-11-11T12:34:56","TestDateTimeCollection":["2000-01-01T12:34:56","3000-01-01T12:34:56"],"TestDateTimeOffset":"2200-11-11T12:34:56-05:00","TestDateTimeOffsetCollection":["2000-01-01T12:34:56-08:00"],"TestDecimal":-123450.01,"TestDecimalCollection":[-1234567890.01],"TestDefaultString":"MyDefaultStringInCollection1","TestDefaultStringCollection":["S1","\u0022S2\u0022","S3"],"TestDouble":-1.2345,"TestDoubleCollection":[-1.23456789,1.23456789,0],"TestEnum":-1,"TestEnumCollection":[-1,-3,-7],"TestEnumWithIntConverter":2,"TestEnumWithIntConverterCollection":[-1,-3,-7],"TestGuid":"00000000-0000-0000-0000-000000000000","TestGuidCollection":["12345678-1234-4321-7777-987654321000"],"TestInt16":-12,"TestInt16Collection":[-32768,0,32767],"TestInt32":32,"TestInt32Collection":[-2147483648,0,2147483647],"TestInt64":64,"TestInt64Collection":[-9223372036854775808,0,9223372036854775807],"TestMaxLengthString":"Baz","TestMaxLengthStringCollection":["S1","S2","S3"],"TestNullableEnum":-1,"TestNullableEnumCollection":[-1,null,-3,-7],"TestNullableEnumWithConverterThatHandlesNulls":"Two","TestNullableEnumWithConverterThatHandlesNullsCollection":[-1,null,-7],"TestNullableEnumWithIntConverter":-3,"TestNullableEnumWithIntConverterCollection":[-1,null,-3,-7],"TestNullableInt32":90,"TestNullableInt32Collection":[null,-2147483648,0,null,2147483647,null],"TestSignedByte":-18,"TestSignedByteCollection":[-128,0,127],"TestSingle":-1.4,"TestSingleCollection":[-1.234,0,-1.234],"TestTimeOnly":"05:07:08.0000000","TestTimeOnlyCollection":["13:42:23.0000000","07:17:25.0000000"],"TestTimeSpan":"6:05:04.003","TestTimeSpanCollection":["10:09:08.007","-9:50:51.993"],"TestUnsignedInt16":12,"TestUnsignedInt16Collection":[0,0,65535],"TestUnsignedInt32":12345,"TestUnsignedInt32Collection":[0,0,4294967295],"TestUnsignedInt64":1234567867,"TestUnsignedInt64Collection":[0,0,18446744073709551615]}' (Nullable = false) (Size = 2158) -@p1='{"TestBoolean":true,"TestBooleanCollection":[true,false],"TestByte":255,"TestByteArray":"AQID","TestByteCollection":null,"TestCharacter":"a","TestCharacterCollection":["A","B","\u0022"],"TestDateOnly":"2023-10-10","TestDateOnlyCollection":["1234-01-23","4321-01-21"],"TestDateTime":"2000-01-01T12:34:56","TestDateTimeCollection":["2000-01-01T12:34:56","3000-01-01T12:34:56"],"TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDateTimeOffsetCollection":["2000-01-01T12:34:56-08:00"],"TestDecimal":-1234567890.01,"TestDecimalCollection":[-1234567890.01],"TestDefaultString":"MyDefaultStringInReference1","TestDefaultStringCollection":["S1","\u0022S2\u0022","S3"],"TestDouble":-1.23456789,"TestDoubleCollection":[-1.23456789,1.23456789,0],"TestEnum":-1,"TestEnumCollection":[-1,-3,-7],"TestEnumWithIntConverter":2,"TestEnumWithIntConverterCollection":[-1,-3,-7],"TestGuid":"12345678-1234-4321-7777-987654321000","TestGuidCollection":["12345678-1234-4321-7777-987654321000"],"TestInt16":-1234,"TestInt16Collection":[-32768,0,32767],"TestInt32":32,"TestInt32Collection":[-2147483648,0,2147483647],"TestInt64":64,"TestInt64Collection":[-9223372036854775808,0,9223372036854775807],"TestMaxLengthString":"Foo","TestMaxLengthStringCollection":["S1","S2","S3"],"TestNullableEnum":-1,"TestNullableEnumCollection":[-1,null,-3,-7],"TestNullableEnumWithConverterThatHandlesNulls":"Three","TestNullableEnumWithConverterThatHandlesNullsCollection":[-1,null,-7],"TestNullableEnumWithIntConverter":2,"TestNullableEnumWithIntConverterCollection":[-1,null,-3,-7],"TestNullableInt32":78,"TestNullableInt32Collection":[null,-2147483648,0,null,2147483647,null],"TestSignedByte":-128,"TestSignedByteCollection":[-128,0,127],"TestSingle":-1.234,"TestSingleCollection":[-1.234,0,-1.234],"TestTimeOnly":"11:12:13.0000000","TestTimeOnlyCollection":["11:42:23.0000000","07:17:27.0000000"],"TestTimeSpan":"10:09:08.007","TestTimeSpanCollection":["10:09:08.007","-9:50:51.993"],"TestUnsignedInt16":1234,"TestUnsignedInt16Collection":[0,0,65535],"TestUnsignedInt32":1234565789,"TestUnsignedInt32Collection":[0,0,4294967295],"TestUnsignedInt64":1234567890123456789,"TestUnsignedInt64Collection":[0,0,18446744073709551615]}' (Nullable = false) (Size = 2192) +@p0='{"TestBoolean":false,"TestBooleanCollection":[true,false],"TestByte":25,"TestByteArray":"","TestByteCollection":null,"TestCharacter":"h","TestCharacterCollection":["A","B","\u0022"],"TestDateOnly":"2323-04-03","TestDateOnlyCollection":["3234-01-23","4331-01-21"],"TestDateTime":"2100-11-11T12:34:56","TestDateTimeCollection":["2000-01-01T12:34:56","3000-01-01T12:34:56"],"TestDateTimeOffset":"2200-11-11T12:34:56-05:00","TestDateTimeOffsetCollection":["2000-01-01T12:34:56-08:00"],"TestDecimal":-123450.01,"TestDecimalCollection":[-1234567890.01],"TestDefaultString":"MyDefaultStringInCollection1","TestDefaultStringCollection":["S1","\u0022S2\u0022","S3"],"TestDouble":-1.2345,"TestDoubleCollection":[-1.23456789,1.23456789,0],"TestEnum":-1,"TestEnumCollection":[-1,-3,-7],"TestEnumWithIntConverter":2,"TestEnumWithIntConverterCollection":[-1,-3,-7],"TestGuid":"00000000-0000-0000-0000-000000000000","TestGuidCollection":["12345678-1234-4321-7777-987654321000"],"TestInt16":-12,"TestInt16Collection":[-32768,0,32767],"TestInt32":32,"TestInt32Collection":[-2147483648,0,2147483647],"TestInt64":64,"TestInt64Collection":[-9223372036854775808,0,9223372036854775807],"TestMaxLengthString":"Baz","TestMaxLengthStringCollection":["S1","S2","S3"],"TestNullableEnum":-1,"TestNullableEnumCollection":[-1,null,-3,-7],"TestNullableEnumWithConverterThatHandlesNulls":"Two","TestNullableEnumWithConverterThatHandlesNullsCollection":[-1,null,-7],"TestNullableEnumWithIntConverter":-3,"TestNullableEnumWithIntConverterCollection":[-1,null,-3,-7],"TestNullableInt32":90,"TestNullableInt32Collection":[null,-2147483648,0,null,2147483647,null],"TestSignedByte":-18,"TestSignedByteCollection":[-128,0,127],"TestSingle":-1.4,"TestSingleCollection":[-1.234,0,-1.234],"TestTimeOnly":"05:07:08.0000000","TestTimeOnlyCollection":["13:42:23.0000000","07:17:25.0000000"],"TestTimeSpan":"6:05:04.003","TestTimeSpanCollection":["10:09:08.007","-9:50:51.993"],"TestUnsignedInt16":12,"TestUnsignedInt16Collection":[0,0,65535],"TestUnsignedInt32":12345,"TestUnsignedInt32Collection":[0,0,4294967295],"TestUnsignedInt64":1234567867,"TestUnsignedInt64Collection":[0,0,9223372036854775807]}' (Nullable = false) (Size = 2157) +@p1='{"TestBoolean":true,"TestBooleanCollection":[true,false],"TestByte":255,"TestByteArray":"AQID","TestByteCollection":null,"TestCharacter":"a","TestCharacterCollection":["A","B","\u0022"],"TestDateOnly":"2023-10-10","TestDateOnlyCollection":["1234-01-23","4321-01-21"],"TestDateTime":"2000-01-01T12:34:56","TestDateTimeCollection":["2000-01-01T12:34:56","3000-01-01T12:34:56"],"TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDateTimeOffsetCollection":["2000-01-01T12:34:56-08:00"],"TestDecimal":-1234567890.01,"TestDecimalCollection":[-1234567890.01],"TestDefaultString":"MyDefaultStringInReference1","TestDefaultStringCollection":["S1","\u0022S2\u0022","S3"],"TestDouble":-1.23456789,"TestDoubleCollection":[-1.23456789,1.23456789,0],"TestEnum":-1,"TestEnumCollection":[-1,-3,-7],"TestEnumWithIntConverter":2,"TestEnumWithIntConverterCollection":[-1,-3,-7],"TestGuid":"12345678-1234-4321-7777-987654321000","TestGuidCollection":["12345678-1234-4321-7777-987654321000"],"TestInt16":-1234,"TestInt16Collection":[-32768,0,32767],"TestInt32":32,"TestInt32Collection":[-2147483648,0,2147483647],"TestInt64":64,"TestInt64Collection":[-9223372036854775808,0,9223372036854775807],"TestMaxLengthString":"Foo","TestMaxLengthStringCollection":["S1","S2","S3"],"TestNullableEnum":-1,"TestNullableEnumCollection":[-1,null,-3,-7],"TestNullableEnumWithConverterThatHandlesNulls":"Three","TestNullableEnumWithConverterThatHandlesNullsCollection":[-1,null,-7],"TestNullableEnumWithIntConverter":2,"TestNullableEnumWithIntConverterCollection":[-1,null,-3,-7],"TestNullableInt32":78,"TestNullableInt32Collection":[null,-2147483648,0,null,2147483647,null],"TestSignedByte":-128,"TestSignedByteCollection":[-128,0,127],"TestSingle":-1.234,"TestSingleCollection":[-1.234,0,-1.234],"TestTimeOnly":"11:12:13.0000000","TestTimeOnlyCollection":["11:42:23.0000000","07:17:27.0000000"],"TestTimeSpan":"10:09:08.007","TestTimeSpanCollection":["10:09:08.007","-9:50:51.993"],"TestUnsignedInt16":1234,"TestUnsignedInt16Collection":[0,0,65535],"TestUnsignedInt32":1234565789,"TestUnsignedInt32Collection":[0,0,4294967295],"TestUnsignedInt64":1234567890123456789,"TestUnsignedInt64Collection":[0,0,9223372036854775807]}' (Nullable = false) (Size = 2191) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -1264,25 +1260,22 @@ public override async Task Edit_two_properties_on_same_entity_updates_the_entire UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0]', JSON_QUERY(@p0)), [Reference] = @p1 OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_a_scalar_property_and_reference_navigation_on_the_same_entity() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_a_scalar_property_and_reference_navigation_on_the_same_entity())) - .InnerException?.Message); + await base.Edit_a_scalar_property_and_reference_navigation_on_the_same_entity(); AssertSql( """ -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] -FROM [JsonEntitiesBasic] AS [j] -""", - // - """ -@p0='{"Date":"2100-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":123.532,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":null}' (Nullable = false) (Size = 245) +@p0='{"Date":"2100-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":523.532,"Id":88,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit"}}' (Nullable = false) (Size = 278) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -1290,25 +1283,21 @@ FROM [JsonEntitiesBasic] AS [j] UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Edit_a_scalar_property_and_collection_navigation_on_the_same_entity() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_a_scalar_property_and_collection_navigation_on_the_same_entity())) - .InnerException?.Message); + await base.Edit_a_scalar_property_and_collection_navigation_on_the_same_entity(); AssertSql( """ -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] -FROM [JsonEntitiesBasic] AS [j] -""", - // - """ -@p0='{"Date":"2100-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":123.532,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_r_r"}}' (Nullable = false) (Size = 207) +@p0='{"Date":"2100-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":523.532,"Id":88,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"edit"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_r_r"}}' (Nullable = false) (Size = 242) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -1316,21 +1305,21 @@ FROM [JsonEntitiesBasic] AS [j] UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Edit_a_scalar_property_and_another_property_behind_reference_navigation_on_the_same_entity() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() - => base.Edit_a_scalar_property_and_another_property_behind_reference_navigation_on_the_same_entity())) - .InnerException?.Message); + await base.Edit_a_scalar_property_and_another_property_behind_reference_navigation_on_the_same_entity(); AssertSql( """ -@p0='{"Date":"2100-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":523.532,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit"}}' (Nullable = false) (Size = 270) +@p0='{"Date":"2100-01-01T00:00:00","Enum":-1,"Enums":[-1,-1,2],"Fraction":523.532,"Id":88,"NullableEnum":null,"NullableEnums":[null,-1,2],"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit"}}' (Nullable = false) (Size = 278) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -1338,6 +1327,11 @@ public override async Task Edit_a_scalar_property_and_another_property_behind_re UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch', JSON_QUERY(@p0)) OUTPUT 1 WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } @@ -1483,10 +1477,7 @@ FROM [JsonEntitiesConverters] AS [j] public override async Task Edit_single_property_collection_of_numeric() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_numeric())).InnerException?.Message); + await base.Edit_single_property_collection_of_numeric(); AssertSql( """ @@ -1499,15 +1490,17 @@ public override async Task Edit_single_property_collection_of_numeric() UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Numbers', JSON_QUERY(@p0)), [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.Numbers', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] """); } public override async Task Edit_single_property_collection_of_bool() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_bool())).InnerException?.Message); + await base.Edit_single_property_collection_of_bool(); AssertSql( """ @@ -1520,6 +1513,12 @@ public override async Task Edit_single_property_collection_of_bool() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestBooleanCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestBooleanCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } @@ -1574,11 +1573,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_collection_of_datetime() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_datetime())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_datetime(); AssertSql( """ @@ -1591,16 +1586,18 @@ public override async Task Edit_single_property_collection_of_datetime() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateTimeCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateTimeCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_datetimeoffset() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_datetimeoffset())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_datetimeoffset(); AssertSql( """ @@ -1613,15 +1610,18 @@ public override async Task Edit_single_property_collection_of_datetimeoffset() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateTimeOffsetCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateTimeOffsetCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_decimal() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_decimal())).InnerException?.Message); + await base.Edit_single_property_collection_of_decimal(); AssertSql( """ @@ -1634,15 +1634,18 @@ public override async Task Edit_single_property_collection_of_decimal() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDecimalCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDecimalCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_double() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_double())).InnerException?.Message); + await base.Edit_single_property_collection_of_double(); AssertSql( """ @@ -1655,15 +1658,18 @@ public override async Task Edit_single_property_collection_of_double() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDoubleCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDoubleCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_guid() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_guid())).InnerException?.Message); + await base.Edit_single_property_collection_of_guid(); AssertSql( """ @@ -1676,15 +1682,18 @@ public override async Task Edit_single_property_collection_of_guid() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestGuidCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestGuidCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_int16() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_int16())).InnerException?.Message); + await base.Edit_single_property_collection_of_int16(); AssertSql( """ @@ -1697,15 +1706,18 @@ public override async Task Edit_single_property_collection_of_int16() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt16Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt16Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_int32() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_int32())).InnerException?.Message); + await base.Edit_single_property_collection_of_int32(); AssertSql( """ @@ -1718,15 +1730,18 @@ public override async Task Edit_single_property_collection_of_int32() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt32Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt32Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_int64() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_int64())).InnerException?.Message); + await base.Edit_single_property_collection_of_int64(); AssertSql( """ @@ -1739,16 +1754,18 @@ public override async Task Edit_single_property_collection_of_int64() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt64Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt64Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_signed_byte() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_signed_byte())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_signed_byte(); AssertSql( """ @@ -1761,15 +1778,18 @@ public override async Task Edit_single_property_collection_of_signed_byte() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestSignedByteCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestSignedByteCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_single() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_single())).InnerException?.Message); + await base.Edit_single_property_collection_of_single(); AssertSql( """ @@ -1782,16 +1802,18 @@ public override async Task Edit_single_property_collection_of_single() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestSingleCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestSingleCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_timespan() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_timespan())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_timespan(); AssertSql( """ @@ -1804,16 +1826,18 @@ public override async Task Edit_single_property_collection_of_timespan() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestTimeSpanCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestTimeSpanCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_dateonly() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_dateonly())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_dateonly(); AssertSql( """ @@ -1826,16 +1850,18 @@ public override async Task Edit_single_property_collection_of_dateonly() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateOnlyCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateOnlyCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_timeonly() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_timeonly())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_timeonly(); AssertSql( """ @@ -1848,15 +1874,18 @@ public override async Task Edit_single_property_collection_of_timeonly() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestTimeOnlyCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestTimeOnlyCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_uint16() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_uint16())).InnerException?.Message); + await base.Edit_single_property_collection_of_uint16(); AssertSql( """ @@ -1869,15 +1898,18 @@ public override async Task Edit_single_property_collection_of_uint16() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt16Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt16Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_uint32() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_uint32())).InnerException?.Message); + await base.Edit_single_property_collection_of_uint32(); AssertSql( """ @@ -1890,15 +1922,18 @@ public override async Task Edit_single_property_collection_of_uint32() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt32Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt32Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_uint64() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_uint64())).InnerException?.Message); + await base.Edit_single_property_collection_of_uint64(); AssertSql( """ @@ -1911,16 +1946,18 @@ public override async Task Edit_single_property_collection_of_uint64() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt64Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt64Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_nullable_int32() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_nullable_int32())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_nullable_int32(); AssertSql( """ @@ -1933,6 +1970,12 @@ public override async Task Edit_single_property_collection_of_nullable_int32() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableInt32Collection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableInt32Collection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } @@ -1962,10 +2005,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_collection_of_enum() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_enum())).InnerException?.Message); + await base.Edit_single_property_collection_of_enum(); AssertSql( """ @@ -1978,16 +2018,18 @@ public override async Task Edit_single_property_collection_of_enum() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_enum_with_int_converter() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_enum_with_int_converter())) - .InnerException?.Message); + await base.Edit_single_property_collection_of_enum_with_int_converter(); AssertSql( """ @@ -2000,16 +2042,18 @@ public override async Task Edit_single_property_collection_of_enum_with_int_conv UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumWithIntConverterCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumWithIntConverterCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } public override async Task Edit_single_property_collection_of_nullable_enum() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_nullable_enum())).InnerException - ?.Message); + await base.Edit_single_property_collection_of_nullable_enum(); AssertSql( """ @@ -2022,6 +2066,12 @@ public override async Task Edit_single_property_collection_of_nullable_enum() UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } @@ -2051,11 +2101,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_collection_of_nullable_enum_with_int_converter() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() => base.Edit_single_property_collection_of_nullable_enum_with_int_converter())) - .InnerException?.Message); + await base.Edit_single_property_collection_of_nullable_enum_with_int_converter(); AssertSql( """ @@ -2068,6 +2114,12 @@ public override async Task Edit_single_property_collection_of_nullable_enum_with UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverterCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverterCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } @@ -2097,11 +2149,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_collection_of_nullable_enum_with_converter_that_handles_nulls() { - // TODO:SQLJSON (See JsonTypeToFunction.cs) - Assert.Equal( - "Argument data type json is invalid for argument 3 of json_modify function.", - (await Assert.ThrowsAsync(() - => base.Edit_single_property_collection_of_nullable_enum_with_converter_that_handles_nulls())).InnerException?.Message); + await base.Edit_single_property_collection_of_nullable_enum_with_converter_that_handles_nulls(); AssertSql( """ @@ -2114,6 +2162,12 @@ public override async Task Edit_single_property_collection_of_nullable_enum_with UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithConverterThatHandlesNullsCollection', JSON_QUERY(@p0)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithConverterThatHandlesNullsCollection', JSON_QUERY(@p1)) OUTPUT 1 WHERE [Id] = @p2; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[TestBooleanCollection], [j].[TestByteCollection], [j].[TestCharacterCollection], [j].[TestDateTimeCollection], [j].[TestDateTimeOffsetCollection], [j].[TestDecimalCollection], [j].[TestDefaultStringCollection], [j].[TestDoubleCollection], [j].[TestEnumCollection], [j].[TestEnumWithIntConverterCollection], [j].[TestGuidCollection], [j].[TestInt16Collection], [j].[TestInt32Collection], [j].[TestInt64Collection], [j].[TestMaxLengthStringCollection], [j].[TestNullableEnumCollection], [j].[TestNullableEnumWithConverterThatHandlesNullsCollection], [j].[TestNullableEnumWithIntConverterCollection], [j].[TestNullableInt32Collection], [j].[TestSignedByteCollection], [j].[TestSingleCollection], [j].[TestTimeSpanCollection], [j].[TestUnsignedInt16Collection], [j].[TestUnsignedInt32Collection], [j].[TestUnsignedInt64Collection], [j].[Collection], [j].[Reference] +FROM [JsonEntitiesAllTypes] AS [j] +WHERE [j].[Id] = 1 """); } @@ -2141,13 +2195,258 @@ FROM [JsonEntitiesAllTypes] AS [j] """); } - public override Task Add_and_update_nested_optional_owned_collection_to_JSON(bool? value) - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - => Assert.ThrowsAsync(() => base.Add_and_update_nested_optional_owned_collection_to_JSON(value)); + public override async Task Add_and_update_nested_optional_owned_collection_to_JSON(bool? value) + { + await base.Add_and_update_nested_optional_owned_collection_to_JSON(value); - public override Task Add_and_update_top_level_optional_owned_collection_to_JSON(bool? value) - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - => Assert.ThrowsAsync(() => base.Add_and_update_top_level_optional_owned_collection_to_JSON(value)); + if (value == null) + { + AssertSql( + """ +@p0='{"Id":0,"Name":null,"Names":null,"Number":0,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":null}' (Nullable = false) (Size = 116) +@p1='2' +@p2=NULL (DbType = Int32) +@p3='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [JsonEntitiesBasic] ([OwnedReferenceRoot], [Id], [EntityBasicId], [Name]) +VALUES (@p0, @p1, @p2, @p3); +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +""", + // + """ +@p0='{"Id":0,"Name":null,"Names":null,"Number":0,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":null}' (Nullable = false) (Size = 114) +@p1='2' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = @p0 +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +"""); + } + else if (value.Value) + { + AssertSql( + """ +@p0='{"Id":0,"Name":null,"Names":null,"Number":0,"Numbers":null,"OwnedCollectionBranch":[{"Date":"0001-01-01T00:00:00","Enum":0,"Enums":null,"Fraction":0,"Id":0,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":null}],"OwnedReferenceBranch":null}' (Nullable = false) (Size = 280) +@p1='2' +@p2=NULL (DbType = Int32) +@p3='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [JsonEntitiesBasic] ([OwnedReferenceRoot], [Id], [EntityBasicId], [Name]) +VALUES (@p0, @p1, @p2, @p3); +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +""", + // + """ +@p0=NULL (Nullable = false) +@p1='2' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch', JSON_QUERY(@p0)) +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +"""); + } + else + { + AssertSql( + """ +@p0='{"Id":0,"Name":null,"Names":null,"Number":0,"Numbers":null,"OwnedCollectionBranch":[],"OwnedReferenceBranch":null}' (Nullable = false) (Size = 114) +@p1='2' +@p2=NULL (DbType = Int32) +@p3='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [JsonEntitiesBasic] ([OwnedReferenceRoot], [Id], [EntityBasicId], [Name]) +VALUES (@p0, @p1, @p2, @p3); +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +""", + // + """ +@p0='[{"Date":"0001-01-01T00:00:00","Enum":0,"Enums":null,"Fraction":0,"Id":0,"NullableEnum":null,"NullableEnums":null,"OwnedCollectionLeaf":null,"OwnedReferenceLeaf":null}]' (Nullable = false) (Size = 168) +@p1='2' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [JsonEntitiesBasic] SET [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedCollectionBranch', JSON_QUERY(@p0)) +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +"""); + } + } + + public override async Task Add_and_update_top_level_optional_owned_collection_to_JSON(bool? value) + { + await base.Add_and_update_top_level_optional_owned_collection_to_JSON(value); + + if (value == null) + { + AssertSql( + """ +@p0='2' +@p1=NULL (DbType = Int32) +@p2='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [JsonEntitiesBasic] ([Id], [EntityBasicId], [Name]) +VALUES (@p0, @p1, @p2); +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +""", + // + """ +@p0='[]' (Nullable = false) (Size = 2) +@p3='2' +@p1=NULL (DbType = Int32) +@p2='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = @p0, [EntityBasicId] = @p1, [Name] = @p2 +OUTPUT 1 +WHERE [Id] = @p3; +""", + // + """ +select OwnedCollectionRoot from JsonEntitiesBasic where Id = 2 +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +"""); + } + else if (value.Value) + { + AssertSql( + """ +@p0='[{"Id":0,"Name":null,"Names":null,"Number":0,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":null}]' (Nullable = false) (Size = 118) +@p1='2' +@p2=NULL (DbType = Int32) +@p3='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [JsonEntitiesBasic] ([OwnedCollectionRoot], [Id], [EntityBasicId], [Name]) +VALUES (@p0, @p1, @p2, @p3); +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +""", + // + """ +@p0=NULL (Nullable = false) +@p1='2' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = @p0 +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +select OwnedCollectionRoot from JsonEntitiesBasic where Id = 2 +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +"""); + } + else + { + AssertSql( + """ +@p0='[]' (Nullable = false) (Size = 2) +@p1='2' +@p2=NULL (DbType = Int32) +@p3='NewEntity' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [JsonEntitiesBasic] ([OwnedCollectionRoot], [Id], [EntityBasicId], [Name]) +VALUES (@p0, @p1, @p2, @p3); +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +""", + // + """ +@p0='[{"Id":0,"Name":null,"Names":null,"Number":0,"Numbers":null,"OwnedCollectionBranch":null,"OwnedReferenceBranch":null}]' (Nullable = false) (Size = 118) +@p1='2' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = @p0 +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +select OwnedCollectionRoot from JsonEntitiesBasic where Id = 2 +""", + // + """ +SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] +FROM [JsonEntitiesBasic] AS [j] +WHERE [j].[Id] = 2 +"""); + } + } [ConditionalTheory(Skip = "TODO:SQLJSON Hangs (See InsertsHang.cs")] public override async Task Add_and_update_nested_optional_primitive_collection(bool? value) @@ -2703,9 +3002,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_relational_collection_of_nullable_int32_set_to_null() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() - => base.Edit_single_property_relational_collection_of_nullable_int32_set_to_null()); + await base.Edit_single_property_relational_collection_of_nullable_int32_set_to_null(); AssertSql( """ @@ -2797,9 +3094,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_relational_collection_of_nullable_enum_set_to_null() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() - => base.Edit_single_property_relational_collection_of_nullable_enum_set_to_null()); + await base.Edit_single_property_relational_collection_of_nullable_enum_set_to_null(); AssertSql( """ @@ -2845,9 +3140,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_relational_collection_of_nullable_enum_with_int_converter_set_to_null() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() - => base.Edit_single_property_relational_collection_of_nullable_enum_with_int_converter_set_to_null()); + await base.Edit_single_property_relational_collection_of_nullable_enum_with_int_converter_set_to_null(); AssertSql( """ @@ -2893,9 +3186,7 @@ FROM [JsonEntitiesAllTypes] AS [j] public override async Task Edit_single_property_relational_collection_of_nullable_enum_with_converter_that_handles_nulls_set_to_null() { - // TODO:SQLJSON Updates to null fail (See UpdateToNull.cs) - await Assert.ThrowsAsync(() - => base.Edit_single_property_relational_collection_of_nullable_enum_with_converter_that_handles_nulls_set_to_null()); + await base.Edit_single_property_relational_collection_of_nullable_enum_with_converter_that_handles_nulls_set_to_null(); AssertSql( """