diff --git a/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs b/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs index 63e038a..d9a07d2 100644 --- a/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs @@ -1,11 +1,9 @@ -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; +using System; using System.Collections.Generic; -using System.Linq; using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.EntityFrameworkCore.Update; namespace EntityFrameworkCore.Jet.FunctionalTests { @@ -15,17 +13,13 @@ namespace EntityFrameworkCore.Jet.FunctionalTests protected override ICollection IgnoredTestBases { get; } = new HashSet { typeof(SpatialQueryRelationalTestBase<>), - typeof(Microsoft.EntityFrameworkCore.Query.SpatialQueryTestBase<>), - typeof(Microsoft.EntityFrameworkCore.SpatialTestBase<>), - typeof(PrimitiveCollectionsQueryTestBase<>), + typeof(SpatialQueryTestBase<>), + typeof(SpatialTestBase<>), typeof(NonSharedPrimitiveCollectionsQueryTestBase), typeof(NonSharedPrimitiveCollectionsQueryRelationalTestBase), - //Gears of War is our own customized version so we can ignore the Microsoft TestBase classes - typeof(Microsoft.EntityFrameworkCore.Query.GearsOfWarQueryTestBase<>), - typeof(Microsoft.EntityFrameworkCore.Query.TPTGearsOfWarQueryRelationalTestBase<>), - typeof(Microsoft.EntityFrameworkCore.Query.GearsOfWarQueryRelationalTestBase<>), - typeof(Microsoft.EntityFrameworkCore.Query.TPCGearsOfWarQueryRelationalTestBase<>), - typeof(Microsoft.EntityFrameworkCore.Query.GearsOfWarFromSqlQueryTestBase<>) + typeof(JsonQueryTestBase<>), + typeof(JsonQueryAdHocTestBase), + typeof(JsonUpdateTestBase<>) }; protected override Assembly TargetAssembly { get; } = typeof(JetComplianceTest).Assembly; diff --git a/test/EFCore.Jet.FunctionalTests/Query/JsonQueryAdHocJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/JsonQueryAdHocJetTest.cs deleted file mode 100644 index 07f5557..0000000 --- a/test/EFCore.Jet.FunctionalTests/Query/JsonQueryAdHocJetTest.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -public class JsonQueryAdHocJetTest : JsonQueryAdHocTestBase -{ - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; - - protected override void Seed29219(MyContext29219 ctx) - { - var entity1 = new MyEntity29219 - { - Id = 1, - Reference = new MyJsonEntity29219 { NonNullableScalar = 10, NullableScalar = 11 }, - Collection = new List - { - new MyJsonEntity29219 { NonNullableScalar = 100, NullableScalar = 101 }, - new MyJsonEntity29219 { NonNullableScalar = 200, NullableScalar = 201 }, - new MyJsonEntity29219 { NonNullableScalar = 300, NullableScalar = null }, - } - }; - - var entity2 = new MyEntity29219 - { - Id = 2, - Reference = new MyJsonEntity29219 { NonNullableScalar = 20, NullableScalar = null }, - Collection = new List - { - new MyJsonEntity29219 { NonNullableScalar = 1001, NullableScalar = null }, - } - }; - - ctx.Entities.AddRange(entity1, entity2); - ctx.SaveChanges(); - - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Reference], [Collection]) -VALUES(3, '{{ ""NonNullableScalar"" : 30 }}', '[{{ ""NonNullableScalar"" : 10001 }}]')"); - } - - protected override void Seed30028(MyContext30028 ctx) - { - // complete - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) -VALUES( -1, -'{{""RootName"":""e1"",""Collection"":[{{""BranchName"":""e1 c1"",""Nested"":{{""LeafName"":""e1 c1 l""}}}},{{""BranchName"":""e1 c2"",""Nested"":{{""LeafName"":""e1 c2 l""}}}}],""OptionalReference"":{{""BranchName"":""e1 or"",""Nested"":{{""LeafName"":""e1 or l""}}}},""RequiredReference"":{{""BranchName"":""e1 rr"",""Nested"":{{""LeafName"":""e1 rr l""}}}}}}')"); - - // missing collection - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) -VALUES( -2, -'{{""RootName"":""e2"",""OptionalReference"":{{""BranchName"":""e2 or"",""Nested"":{{""LeafName"":""e2 or l""}}}},""RequiredReference"":{{""BranchName"":""e2 rr"",""Nested"":{{""LeafName"":""e2 rr l""}}}}}}')"); - - // missing optional reference - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) -VALUES( -3, -'{{""RootName"":""e3"",""Collection"":[{{""BranchName"":""e3 c1"",""Nested"":{{""LeafName"":""e3 c1 l""}}}},{{""BranchName"":""e3 c2"",""Nested"":{{""LeafName"":""e3 c2 l""}}}}],""RequiredReference"":{{""BranchName"":""e3 rr"",""Nested"":{{""LeafName"":""e3 rr l""}}}}}}')"); - - // missing required reference - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) -VALUES( -4, -'{{""RootName"":""e4"",""Collection"":[{{""BranchName"":""e4 c1"",""Nested"":{{""LeafName"":""e4 c1 l""}}}},{{""BranchName"":""e4 c2"",""Nested"":{{""LeafName"":""e4 c2 l""}}}}],""OptionalReference"":{{""BranchName"":""e4 or"",""Nested"":{{""LeafName"":""e4 or l""}}}}}}')"); - } - - protected override void SeedArrayOfPrimitives(MyContextArrayOfPrimitives ctx) - { - var entity1 = new MyEntityArrayOfPrimitives - { - Id = 1, - Reference = new MyJsonEntityArrayOfPrimitives - { - IntArray = new int[] { 1, 2, 3 }, - ListOfString = new List { "Foo", "Bar", "Baz" } - }, - Collection = new List - { - new MyJsonEntityArrayOfPrimitives - { - IntArray = new int[] { 111, 112, 113 }, - ListOfString = new List { "Foo11", "Bar11" } - }, - new MyJsonEntityArrayOfPrimitives - { - IntArray = new int[] { 211, 212, 213 }, - ListOfString = new List { "Foo12", "Bar12" } - }, - } - }; - - var entity2 = new MyEntityArrayOfPrimitives - { - Id = 2, - Reference = new MyJsonEntityArrayOfPrimitives - { - IntArray = new int[] { 10, 20, 30 }, - ListOfString = new List { "A", "B", "C" } - }, - Collection = new List - { - new MyJsonEntityArrayOfPrimitives - { - IntArray = new int[] { 110, 120, 130 }, - ListOfString = new List { "A1", "Z1" } - }, - new MyJsonEntityArrayOfPrimitives - { - IntArray = new int[] { 210, 220, 230 }, - ListOfString = new List { "A2", "Z2" } - }, - } - }; - - ctx.Entities.AddRange(entity1, entity2); - ctx.SaveChanges(); - } - - protected override void SeedJunkInJson(MyContextJunkInJson ctx) - { - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Collection], [CollectionWithCtor], [Reference], [ReferenceWithCtor], [Id]) -VALUES( -'[{{""JunkReference"":{{""Something"":""SomeValue"" }},""Name"":""c11"",""JunkProperty1"":50,""Number"":11.5,""JunkCollection1"":[],""JunkCollection2"":[{{""Foo"":""junk value""}}],""NestedCollection"":[{{""DoB"":""2002-04-01T00:00:00"",""DummyProp"":""Dummy value""}},{{""DoB"":""2002-04-02T00:00:00"",""DummyReference"":{{""Foo"":5}}}}],""NestedReference"":{{""DoB"":""2002-03-01T00:00:00""}}}},{{""Name"":""c12"",""Number"":12.5,""NestedCollection"":[{{""DoB"":""2002-06-01T00:00:00""}},{{""DoB"":""2002-06-02T00:00:00""}}],""NestedDummy"":59,""NestedReference"":{{""DoB"":""2002-05-01T00:00:00""}}}}]', -'[{{""MyBool"":true,""Name"":""c11 ctor"",""JunkReference"":{{""Something"":""SomeValue"",""JunkCollection"":[{{""Foo"":""junk value""}}]}},""NestedCollection"":[{{""DoB"":""2002-08-01T00:00:00""}},{{""DoB"":""2002-08-02T00:00:00""}}],""NestedReference"":{{""DoB"":""2002-07-01T00:00:00""}}}},{{""MyBool"":false,""Name"":""c12 ctor"",""NestedCollection"":[{{""DoB"":""2002-10-01T00:00:00""}},{{""DoB"":""2002-10-02T00:00:00""}}],""JunkCollection"":[{{""Foo"":""junk value""}}],""NestedReference"":{{""DoB"":""2002-09-01T00:00:00""}}}}]', -'{{""Name"":""r1"",""JunkCollection"":[{{""Foo"":""junk value""}}],""JunkReference"":{{""Something"":""SomeValue"" }},""Number"":1.5,""NestedCollection"":[{{""DoB"":""2000-02-01T00:00:00"",""JunkReference"":{{""Something"":""SomeValue""}}}},{{""DoB"":""2000-02-02T00:00:00""}}],""NestedReference"":{{""DoB"":""2000-01-01T00:00:00""}}}}', -'{{""MyBool"":true,""JunkCollection"":[{{""Foo"":""junk value""}}],""Name"":""r1 ctor"",""JunkReference"":{{""Something"":""SomeValue"" }},""NestedCollection"":[{{""DoB"":""2001-02-01T00:00:00""}},{{""DoB"":""2001-02-02T00:00:00""}}],""NestedReference"":{{""JunkCollection"":[{{""Foo"":""junk value""}}],""DoB"":""2001-01-01T00:00:00""}}}}', -1)"); - } - - protected override void SeedShadowProperties(MyContextShadowProperties ctx) - { - ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Collection], [CollectionWithCtor], [Reference], [ReferenceWithCtor], [Id], [Name]) -VALUES( -'[{{""Name"":""e1_c1"",""ShadowDouble"":5.5}},{{""ShadowDouble"":20.5,""Name"":""e1_c2""}}]', -'[{{""Name"":""e1_c1 ctor"",""ShadowNullableByte"":6}},{{""ShadowNullableByte"":null,""Name"":""e1_c2 ctor""}}]', -'{{""Name"":""e1_r"", ""ShadowString"":""Foo""}}', -'{{""ShadowInt"":143,""Name"":""e1_r ctor""}}', -1, -'e1')"); - } -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/JsonQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/JsonQueryJetFixture.cs deleted file mode 100644 index 2a0ef87..0000000 --- a/test/EFCore.Jet.FunctionalTests/Query/JsonQueryJetFixture.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -public class JsonQueryJetFixture : JsonQueryFixtureBase -{ - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/JsonQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/JsonQueryJetTest.cs deleted file mode 100644 index ebd2bbf..0000000 --- a/test/EFCore.Jet.FunctionalTests/Query/JsonQueryJetTest.cs +++ /dev/null @@ -1,1103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Data.OleDb; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestModels.JsonQuery; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -public class JsonQueryJetTest : JsonQueryTestBase -{ - public JsonQueryJetTest(JsonQueryJetFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - //Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } - - public override async Task Basic_json_projection_owner_entity(bool async) - { - await base.Basic_json_projection_owner_entity(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_owned_reference_root(bool async) - { - await base.Basic_json_projection_owned_reference_root(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_owned_reference_duplicated(bool async) - { - await base.Basic_json_projection_owned_reference_duplicated(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -ORDER BY [j].[Id] -"""); - } - - public override async Task Basic_json_projection_owned_collection_root(bool async) - { - await base.Basic_json_projection_owned_collection_root(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedCollectionRoot],'$'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_owned_reference_branch(bool async) - { - await base.Basic_json_projection_owned_reference_branch(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_owned_collection_branch(bool async) - { - await base.Basic_json_projection_owned_collection_branch(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedCollectionBranch'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_owned_reference_leaf(bool async) - { - await base.Basic_json_projection_owned_reference_leaf(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_owned_collection_leaf(bool async) - { - await base.Basic_json_projection_owned_collection_leaf(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedCollectionLeaf'), [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Basic_json_projection_scalar(bool async) - { - await base.Basic_json_projection_scalar(async); - - AssertSql( -""" -SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Json_scalar_length(bool async) - { - await base.Json_scalar_length(async); - - AssertSql( -""" -SELECT [j].[Name] -FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(LEN(CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max))) AS int) > 2 -"""); - } - - public override async Task Basic_json_projection_enum_inside_json_entity(bool async) - { - await base.Basic_json_projection_enum_inside_json_entity(async); - - AssertSql( -""" -SELECT [j].[Id], CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.Enum') AS nvarchar(max)) AS [Enum] -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Json_projection_enum_with_custom_conversion(bool async) - { - await base.Json_projection_enum_with_custom_conversion(async); - - AssertSql( -""" -SELECT [j].[Id], CAST(JSON_VALUE([j].[json_reference_custom_naming],'$.CustomEnum') AS int) AS [Enum] -FROM [JsonEntitiesCustomNaming] AS [j] -"""); - } - - public override async Task Json_projection_with_deduplication(bool async) - { - await base.Json_projection_with_deduplication(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$'), CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Json_projection_with_deduplication_reverse_order(bool async) - { - await base.Json_projection_with_deduplication_reverse_order(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Json_property_in_predicate(bool async) - { - await base.Json_property_in_predicate(async); - - AssertSql( -""" -SELECT [j].[Id] -FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.Fraction') AS decimal(18,2)) < 20.5 -"""); - } - - public override async Task Json_subquery_property_pushdown_length(bool async) - { - await base.Json_subquery_property_pushdown_length(async); - - AssertSql( -""" -@__p_0='3' - -SELECT CAST(LEN([t0].[c]) AS int) -FROM ( - SELECT DISTINCT [t].[c] - FROM ( - SELECT TOP(@__p_0) CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) AS [c] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] -) AS [t0] -"""); - } - - public override async Task Json_subquery_reference_pushdown_reference(bool async) - { - await base.Json_subquery_reference_pushdown_reference(async); - - AssertSql( -""" -@__p_0='10' - -SELECT JSON_QUERY([t0].[c],'$.OwnedReferenceBranch'), [t0].[Id] -FROM ( - SELECT DISTINCT JSON_QUERY([t].[c],'$') AS [c], [t].[Id] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([j].[OwnedReferenceRoot],'$') AS [c], [j].[Id] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] -) AS [t0] -"""); - } - - public override async Task Json_subquery_reference_pushdown_reference_anonymous_projection(bool async) - { - await base.Json_subquery_reference_pushdown_reference_anonymous_projection(async); - - AssertSql( -""" -@__p_0='10' - -SELECT JSON_QUERY([t0].[c],'$.OwnedReferenceSharedBranch'), [t0].[Id], CAST(LEN([t0].[c0]) AS int) -FROM ( - SELECT DISTINCT JSON_QUERY([t].[c],'$') AS [c], [t].[Id], [t].[c0] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([j].[json_reference_shared],'$') AS [c], [j].[Id], CAST(JSON_VALUE([j].[json_reference_shared],'$.OwnedReferenceSharedBranch.OwnedReferenceSharedLeaf.SomethingSomething') AS nvarchar(max)) AS [c0] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] -) AS [t0] -"""); - } - - 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); - - AssertSql( -""" -@__p_0='10' - -SELECT JSON_QUERY([t2].[c],'$.OwnedReferenceSharedLeaf'), [t2].[Id], JSON_QUERY([t2].[c],'$.OwnedCollectionSharedLeaf'), [t2].[Length] -FROM ( - SELECT DISTINCT JSON_QUERY([t1].[c],'$') AS [c], [t1].[Id], [t1].[Length] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([t0].[c],'$.OwnedReferenceSharedBranch') AS [c], [t0].[Id], CAST(LEN([t0].[Scalar]) AS int) AS [Length] - FROM ( - SELECT DISTINCT JSON_QUERY([t].[c],'$') AS [c], [t].[Id], [t].[Scalar] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([j].[json_reference_shared],'$') AS [c], [j].[Id], CAST(JSON_VALUE([j].[json_reference_shared],'$.OwnedReferenceSharedBranch.OwnedReferenceSharedLeaf.SomethingSomething') AS nvarchar(max)) AS [Scalar] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] - ) AS [t0] - ORDER BY CAST(LEN([t0].[Scalar]) AS int) - ) AS [t1] -) AS [t2] -"""); - } - - public override async Task Json_subquery_reference_pushdown_reference_pushdown_reference(bool async) - { - await base.Json_subquery_reference_pushdown_reference_pushdown_reference(async); - - AssertSql( -""" -@__p_0='10' - -SELECT JSON_QUERY([t2].[c],'$.OwnedReferenceLeaf'), [t2].[Id] -FROM ( - SELECT DISTINCT JSON_QUERY([t1].[c],'$') AS [c], [t1].[Id] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([t0].[c],'$.OwnedReferenceBranch') AS [c], [t0].[Id] - FROM ( - SELECT DISTINCT JSON_QUERY([t].[c],'$') AS [c], [t].[Id], [t].[c] AS [c0] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([j].[OwnedReferenceRoot],'$') AS [c], [j].[Id] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] - ) AS [t0] - ORDER BY CAST(JSON_VALUE([t0].[c0],'$.Name') AS nvarchar(max)) - ) AS [t1] -) AS [t2] -"""); - } - - public override async Task Json_subquery_reference_pushdown_reference_pushdown_collection(bool async) - { - await base.Json_subquery_reference_pushdown_reference_pushdown_collection(async); - - AssertSql( -""" -@__p_0='10' - -SELECT JSON_QUERY([t2].[c],'$.OwnedCollectionLeaf'), [t2].[Id] -FROM ( - SELECT DISTINCT JSON_QUERY([t1].[c],'$') AS [c], [t1].[Id] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([t0].[c],'$.OwnedReferenceBranch') AS [c], [t0].[Id] - FROM ( - SELECT DISTINCT JSON_QUERY([t].[c],'$') AS [c], [t].[Id], [t].[c] AS [c0] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([j].[OwnedReferenceRoot],'$') AS [c], [j].[Id] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] - ) AS [t0] - ORDER BY CAST(JSON_VALUE([t0].[c0],'$.Name') AS nvarchar(max)) - ) AS [t1] -) AS [t2] -"""); - } - - public override async Task Json_subquery_reference_pushdown_property(bool async) - { - await base.Json_subquery_reference_pushdown_property(async); - - AssertSql( -""" -@__p_0='10' - -SELECT CAST(JSON_VALUE([t0].[c],'$.SomethingSomething') AS nvarchar(max)) -FROM ( - SELECT DISTINCT JSON_QUERY([t].[c],'$') AS [c], [t].[Id] - FROM ( - SELECT TOP(@__p_0) JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf') AS [c], [j].[Id] - FROM [JsonEntitiesBasic] AS [j] - ORDER BY [j].[Id] - ) AS [t] -) AS [t0] -"""); - } - - public override async Task Custom_naming_projection_owner_entity(bool async) - { - await base.Custom_naming_projection_owner_entity(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Title], JSON_QUERY([j].[json_collection_custom_naming],'$'), JSON_QUERY([j].[json_reference_custom_naming],'$') -FROM [JsonEntitiesCustomNaming] AS [j] -"""); - } - - public override async Task Custom_naming_projection_owned_reference(bool async) - { - await base.Custom_naming_projection_owned_reference(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[json_reference_custom_naming],'$.CustomOwnedReferenceBranch'), [j].[Id] -FROM [JsonEntitiesCustomNaming] AS [j] -"""); - } - - public override async Task Custom_naming_projection_owned_collection(bool async) - { - await base.Custom_naming_projection_owned_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[json_collection_custom_naming],'$'), [j].[Id] -FROM [JsonEntitiesCustomNaming] AS [j] -ORDER BY [j].[Id] -"""); - } - - public override async Task Custom_naming_projection_owned_scalar(bool async) - { - await base.Custom_naming_projection_owned_scalar(async); - - AssertSql( -""" -SELECT CAST(JSON_VALUE([j].[json_reference_custom_naming],'$.CustomOwnedReferenceBranch.CustomFraction') AS float) -FROM [JsonEntitiesCustomNaming] AS [j] -"""); - } - - public override async Task Custom_naming_projection_everything(bool async) - { - await base.Custom_naming_projection_everything(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Title], JSON_QUERY([j].[json_collection_custom_naming],'$'), JSON_QUERY([j].[json_reference_custom_naming],'$'), CAST(JSON_VALUE([j].[json_reference_custom_naming],'$.CustomName') AS nvarchar(max)), CAST(JSON_VALUE([j].[json_reference_custom_naming],'$.CustomOwnedReferenceBranch.CustomFraction') AS float) -FROM [JsonEntitiesCustomNaming] AS [j] -"""); - } - - public override async Task Project_entity_with_single_owned(bool async) - { - await base.Project_entity_with_single_owned(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Name], JSON_QUERY([j].[OwnedCollection],'$') -FROM [JsonEntitiesSingleOwned] AS [j] -"""); - } - - public override async Task Left_join_json_entities(bool async) - { - await base.Left_join_json_entities(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Name], JSON_QUERY([j].[OwnedCollection],'$'), [j0].[Id], [j0].[EntityBasicId], [j0].[Name], JSON_QUERY([j0].[OwnedCollectionRoot],'$'), JSON_QUERY([j0].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesSingleOwned] AS [j] -LEFT JOIN [JsonEntitiesBasic] AS [j0] ON [j].[Id] = [j0].[Id] -"""); - } - - public override async Task Left_join_json_entities_complex_projection(bool async) - { - await base.Left_join_json_entities_complex_projection(async); - - AssertSql( -""" -SELECT [j].[Id], [j0].[Id], [j0].[EntityBasicId], [j0].[Name], JSON_QUERY([j0].[OwnedCollectionRoot],'$'), JSON_QUERY([j0].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesSingleOwned] AS [j] -LEFT JOIN [JsonEntitiesBasic] AS [j0] ON [j].[Id] = [j0].[Id] -"""); - } - - public override async Task Project_json_entity_FirstOrDefault_subquery(bool async) - { - await base.Project_json_entity_FirstOrDefault_subquery(async); - - AssertSql( -""" -SELECT JSON_QUERY([t].[c],'$'), [t].[Id] -FROM [JsonEntitiesBasic] AS [j] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([j0].[OwnedReferenceRoot],'$.OwnedReferenceBranch') AS [c], [j0].[Id] - FROM [JsonEntitiesBasic] AS [j0] - ORDER BY [j0].[Id] -) AS [t] -ORDER BY [j].[Id] -"""); - } - - public override async Task Project_json_entity_FirstOrDefault_subquery_with_binding_on_top(bool async) - { - await base.Project_json_entity_FirstOrDefault_subquery_with_binding_on_top(async); - - AssertSql( -""" -SELECT ( - SELECT TOP(1) CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.OwnedReferenceBranch.Date') AS datetime2) - FROM [JsonEntitiesBasic] AS [j0] - ORDER BY [j0].[Id]) -FROM [JsonEntitiesBasic] AS [j] -ORDER BY [j].[Id] -"""); - } - - public override async Task Project_json_entity_FirstOrDefault_subquery_with_entity_comparison_on_top(bool async) - { - await base.Project_json_entity_FirstOrDefault_subquery_with_entity_comparison_on_top(async); - - AssertSql( - @""); - } - - public override async Task Project_json_entity_FirstOrDefault_subquery_deduplication(bool async) - { - await base.Project_json_entity_FirstOrDefault_subquery_deduplication(async); - - AssertSql( -""" -SELECT JSON_QUERY([t].[c],'$'), [t].[Id], JSON_QUERY([t].[c0],'$'), [t].[Id0], JSON_QUERY([t].[c1],'$'), [t].[c2], [t].[c3], [t].[c4] -FROM [JsonEntitiesBasic] AS [j] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedCollectionBranch') AS [c], [j].[Id], JSON_QUERY([j0].[OwnedReferenceRoot],'$') AS [c0], [j0].[Id] AS [Id0], JSON_QUERY([j0].[OwnedReferenceRoot],'$.OwnedReferenceBranch') AS [c1], CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [c2], CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.Enum') AS nvarchar(max)) AS [c3], 1 AS [c4] - FROM [JsonEntitiesBasic] AS [j0] - ORDER BY [j0].[Id] -) AS [t] -ORDER BY [j].[Id] -"""); - } - - public override async Task Project_json_entity_FirstOrDefault_subquery_deduplication_and_outer_reference(bool async) - { - await base.Project_json_entity_FirstOrDefault_subquery_deduplication_and_outer_reference(async); - - AssertSql( -""" -SELECT JSON_QUERY([t].[c],'$'), [t].[Id], JSON_QUERY([t].[c0],'$'), [t].[Id0], JSON_QUERY([t].[c1],'$'), [t].[c2], [t].[c3], [t].[c4] -FROM [JsonEntitiesBasic] AS [j] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedCollectionBranch') AS [c], [j].[Id], JSON_QUERY([j0].[OwnedReferenceRoot],'$') AS [c0], [j0].[Id] AS [Id0], JSON_QUERY([j0].[OwnedReferenceRoot],'$.OwnedReferenceBranch') AS [c1], CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [c2], CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.Enum') AS nvarchar(max)) AS [c3], 1 AS [c4] - FROM [JsonEntitiesBasic] AS [j0] - ORDER BY [j0].[Id] -) AS [t] -ORDER BY [j].[Id] -"""); - } - - public override async Task Project_json_entity_FirstOrDefault_subquery_deduplication_outer_reference_and_pruning(bool async) - { - await base.Project_json_entity_FirstOrDefault_subquery_deduplication_outer_reference_and_pruning(async); - - AssertSql( -""" -SELECT JSON_QUERY([t].[c],'$'), [t].[Id], [t].[c0] -FROM [JsonEntitiesBasic] AS [j] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedCollectionBranch') AS [c], [j].[Id], 1 AS [c0] - FROM [JsonEntitiesBasic] AS [j0] - ORDER BY [j0].[Id] -) AS [t] -ORDER BY [j].[Id] -"""); - } - - public override async Task Json_entity_with_inheritance_basic_projection(bool async) - { - await base.Json_entity_with_inheritance_basic_projection(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Discriminator], [j].[Name], [j].[Fraction], JSON_QUERY([j].[CollectionOnBase],'$'), JSON_QUERY([j].[ReferenceOnBase],'$'), JSON_QUERY([j].[CollectionOnDerived],'$'), JSON_QUERY([j].[ReferenceOnDerived],'$') -FROM [JsonEntitiesInheritance] AS [j] -"""); - } - - public override async Task Json_entity_with_inheritance_project_derived(bool async) - { - await base.Json_entity_with_inheritance_project_derived(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Discriminator], [j].[Name], [j].[Fraction], JSON_QUERY([j].[CollectionOnBase],'$'), JSON_QUERY([j].[ReferenceOnBase],'$'), JSON_QUERY([j].[CollectionOnDerived],'$'), JSON_QUERY([j].[ReferenceOnDerived],'$') -FROM [JsonEntitiesInheritance] AS [j] -WHERE [j].[Discriminator] = N'JsonEntityInheritanceDerived' -"""); - } - - public override async Task Json_entity_with_inheritance_project_navigations(bool async) - { - await base.Json_entity_with_inheritance_project_navigations(async); - - AssertSql( -""" -SELECT [j].[Id], JSON_QUERY([j].[ReferenceOnBase],'$'), JSON_QUERY([j].[CollectionOnBase],'$') -FROM [JsonEntitiesInheritance] AS [j] -"""); - } - - public override async Task Json_entity_with_inheritance_project_navigations_on_derived(bool async) - { - await base.Json_entity_with_inheritance_project_navigations_on_derived(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[Discriminator], [j].[Name], [j].[Fraction], JSON_QUERY([j].[CollectionOnBase],'$'), JSON_QUERY([j].[ReferenceOnBase],'$'), JSON_QUERY([j].[CollectionOnDerived],'$'), JSON_QUERY([j].[ReferenceOnDerived],'$') -FROM [JsonEntitiesInheritance] AS [j] -WHERE [j].[Discriminator] = N'JsonEntityInheritanceDerived' -"""); - } - - public override async Task Json_entity_backtracking(bool async) - { - await base.Json_entity_backtracking(async); - - AssertSql( - @""); - } - - public override async Task Json_scalar_required_null_semantics(bool async) - { - await base.Json_scalar_required_null_semantics(async); - - AssertSql( -""" -SELECT [j].[Name] -FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Number') AS int) <> CAST(LEN(CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max))) AS int) OR (CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) IS NULL) -"""); - } - - public override async Task Json_scalar_optional_null_semantics(bool async) - { - await base.Json_scalar_optional_null_semantics(async); - - AssertSql( -""" -SELECT [j].[Name] -FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) = CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) OR ((CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) IS NULL) AND (CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) IS NULL)) -"""); - } - - public override async Task Group_by_on_json_scalar(bool async) - { - await base.Group_by_on_json_scalar(async); - - AssertSql( -""" -SELECT [t].[Key], COUNT(*) AS [Count] -FROM ( - SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j] -) AS [t] -GROUP BY [t].[Key] -"""); - } - - public override async Task Group_by_First_on_json_scalar(bool async) - { - await base.Group_by_First_on_json_scalar(async); - - AssertSql( -""" -SELECT [t1].[Id], [t1].[EntityBasicId], [t1].[Name], JSON_QUERY([t1].[c],'$'), JSON_QUERY([t1].[c0],'$') -FROM ( - SELECT [t].[Key] - FROM ( - SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j] - ) AS [t] - GROUP BY [t].[Key] -) AS [t0] -LEFT JOIN ( - SELECT [t2].[Id], [t2].[EntityBasicId], [t2].[Name], JSON_QUERY([t2].[c],'$') AS [c], JSON_QUERY([t2].[c0],'$') AS [c0], [t2].[Key] - FROM ( - SELECT [t3].[Id], [t3].[EntityBasicId], [t3].[Name], JSON_QUERY([t3].[c],'$') AS [c], JSON_QUERY([t3].[c0],'$') AS [c0], [t3].[Key], ROW_NUMBER() OVER(PARTITION BY [t3].[Key] ORDER BY [t3].[Id]) AS [row] - FROM ( - SELECT [j0].[Id], [j0].[EntityBasicId], [j0].[Name], JSON_QUERY([j0].[OwnedCollectionRoot],'$') AS [c], JSON_QUERY([j0].[OwnedReferenceRoot],'$') AS [c0], CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j0] - ) AS [t3] - ) AS [t2] - WHERE [t2].[row] <= 1 -) AS [t1] ON [t0].[Key] = [t1].[Key] -"""); - } - - public override async Task Group_by_FirstOrDefault_on_json_scalar(bool async) - { - await base.Group_by_FirstOrDefault_on_json_scalar(async); - - AssertSql( -""" -SELECT [t1].[Id], [t1].[EntityBasicId], [t1].[Name], JSON_QUERY([t1].[c],'$'), JSON_QUERY([t1].[c0],'$') -FROM ( - SELECT [t].[Key] - FROM ( - SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j] - ) AS [t] - GROUP BY [t].[Key] -) AS [t0] -LEFT JOIN ( - SELECT [t2].[Id], [t2].[EntityBasicId], [t2].[Name], JSON_QUERY([t2].[c],'$') AS [c], JSON_QUERY([t2].[c0],'$') AS [c0], [t2].[Key] - FROM ( - SELECT [t3].[Id], [t3].[EntityBasicId], [t3].[Name], JSON_QUERY([t3].[c],'$') AS [c], JSON_QUERY([t3].[c0],'$') AS [c0], [t3].[Key], ROW_NUMBER() OVER(PARTITION BY [t3].[Key] ORDER BY [t3].[Id]) AS [row] - FROM ( - SELECT [j0].[Id], [j0].[EntityBasicId], [j0].[Name], JSON_QUERY([j0].[OwnedCollectionRoot],'$') AS [c], JSON_QUERY([j0].[OwnedReferenceRoot],'$') AS [c0], CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j0] - ) AS [t3] - ) AS [t2] - WHERE [t2].[row] <= 1 -) AS [t1] ON [t0].[Key] = [t1].[Key] -"""); - } - - public override async Task Group_by_Skip_Take_on_json_scalar(bool async) - { - await base.Group_by_Skip_Take_on_json_scalar(async); - - AssertSql( -""" -SELECT [t0].[Key], [t1].[Id], [t1].[EntityBasicId], [t1].[Name], [t1].[c], [t1].[c0] -FROM ( - SELECT [t].[Key] - FROM ( - SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j] - ) AS [t] - GROUP BY [t].[Key] -) AS [t0] -LEFT JOIN ( - SELECT [t2].[Id], [t2].[EntityBasicId], [t2].[Name], [t2].[c], [t2].[c0], [t2].[Key] - FROM ( - SELECT [t3].[Id], [t3].[EntityBasicId], [t3].[Name], JSON_QUERY([t3].[c],'$') AS [c], JSON_QUERY([t3].[c0],'$') AS [c0], [t3].[Key], ROW_NUMBER() OVER(PARTITION BY [t3].[Key] ORDER BY [t3].[Id]) AS [row] - FROM ( - SELECT [j0].[Id], [j0].[EntityBasicId], [j0].[Name], JSON_QUERY([j0].[OwnedCollectionRoot],'$') AS [c], JSON_QUERY([j0].[OwnedReferenceRoot],'$') AS [c0], CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j0] - ) AS [t3] - ) AS [t2] - WHERE 1 < [t2].[row] AND [t2].[row] <= 6 -) AS [t1] ON [t0].[Key] = [t1].[Key] -ORDER BY [t0].[Key], [t1].[Key], [t1].[Id] -"""); - } - - public override async Task Group_by_json_scalar_Orderby_json_scalar_FirstOrDefault(bool async) - { - await base.Group_by_json_scalar_Orderby_json_scalar_FirstOrDefault(async); - - AssertSql( - @""); - } - - public override async Task Group_by_json_scalar_Skip_First_project_json_scalar(bool async) - { - await base.Group_by_json_scalar_Skip_First_project_json_scalar(async); - - AssertSql( -""" -SELECT ( - SELECT TOP(1) CAST(JSON_VALUE([t0].[c0],'$.OwnedReferenceBranch.Enum') AS nvarchar(max)) - FROM ( - SELECT [j0].[Id], [j0].[EntityBasicId], [j0].[Name], JSON_QUERY([j0].[OwnedCollectionRoot],'$') AS [c], JSON_QUERY([j0].[OwnedReferenceRoot],'$') AS [c0], CAST(JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j0] - ) AS [t0] - WHERE [t].[Key] = [t0].[Key] OR (([t].[Key] IS NULL) AND ([t0].[Key] IS NULL))) -FROM ( - SELECT CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) AS [Key] - FROM [JsonEntitiesBasic] AS [j] -) AS [t] -GROUP BY [t].[Key] -"""); - } - - public override async Task Json_with_include_on_json_entity(bool async) - { - await base.Json_with_include_on_json_entity(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Json_with_include_on_entity_reference(bool async) - { - await base.Json_with_include_on_entity_reference(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] -"""); - } - - public override async Task Json_with_include_on_entity_collection(bool async) - { - await base.Json_with_include_on_entity_collection(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id] -"""); - } - - public override async Task Entity_including_collection_with_json(bool async) - { - await base.Entity_including_collection_with_json(async); - - AssertSql( -""" -SELECT [e].[Id], [e].[Name], [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [EntitiesBasic] AS [e] -LEFT JOIN [JsonEntitiesBasic] AS [j] ON [e].[Id] = [j].[EntityBasicId] -ORDER BY [e].[Id] -"""); - } - - public override async Task Json_with_include_on_entity_collection_and_reference(bool async) - { - await base.Json_with_include_on_entity_collection_and_reference(async); - - AssertSql( -""" -SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j0].[Id], [j0].[Name], [j0].[ParentId], [j1].[Id], [j1].[Name], [j1].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] -"""); - } - - - public override async Task Json_with_projection_of_json_reference_leaf_and_entity_collection(bool async) - { - await base.Json_with_projection_of_json_reference_leaf_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf'), [j].[Id], [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id] -"""); - } - - public override async Task Json_with_projection_of_json_reference_and_entity_collection(bool async) - { - await base.Json_with_projection_of_json_reference_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j].[Id], [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id] -"""); - } - - public override async Task Json_with_projection_of_multiple_json_references_and_entity_collection(bool async) - { - await base.Json_with_projection_of_multiple_json_references_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$'), [j].[Id], JSON_QUERY([j].[OwnedCollectionRoot],'$'), [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id] -"""); - } - - public override async Task Json_with_projection_of_json_collection_leaf_and_entity_collection(bool async) - { - await base.Json_with_projection_of_json_collection_leaf_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedCollectionLeaf'), [j].[Id], [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id] -"""); - } - - public override async Task Json_with_projection_of_json_collection_and_entity_collection(bool async) - { - await base.Json_with_projection_of_json_collection_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedCollectionRoot],'$'), [j].[Id], [j0].[Id], [j0].[Name], [j0].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j0] ON [j].[Id] = [j0].[ParentId] -ORDER BY [j].[Id] -"""); - } - - public override async Task Json_with_projection_of_json_collection_element_and_entity_collection(bool async) - { - await base.Json_with_projection_of_json_collection_element_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedCollectionRoot],'$'), [j].[Id], [j0].[Id], [j0].[Name], [j0].[ParentId], [j1].[Id], [j1].[Name], [j1].[ParentId] -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] -"""); - } - - public override async Task Json_with_projection_of_mix_of_json_collections_json_references_and_entity_collection(bool async) - { - await base.Json_with_projection_of_mix_of_json_collections_json_references_and_entity_collection(async); - - AssertSql( -""" -SELECT JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedCollectionLeaf'), [j].[Id], [j0].[Id], [j0].[Name], [j0].[ParentId], JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf'), [j1].[Id], [j1].[Name], [j1].[ParentId], JSON_QUERY([j].[OwnedReferenceRoot],'$.OwnedCollectionBranch'), JSON_QUERY([j].[OwnedCollectionRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] -LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] -"""); - } - - public override async Task Json_all_types_entity_projection(bool async) - { - await base.Json_all_types_entity_projection(async); - - AssertSql( -""" -SELECT [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -"""); - } - - public override async Task Json_all_types_projection_individual_properties(bool async) - { - await base.Json_all_types_projection_individual_properties(async); - - AssertSql( -""" -SELECT CAST(JSON_VALUE([j].[Reference],'$.TestBoolean') AS bit) AS [TestBoolean], CAST(JSON_VALUE([j].[Reference],'$.TestByte') AS tinyint) AS [TestByte], CAST(JSON_VALUE([j].[Reference],'$.TestCharacter') AS nvarchar(1)) AS [TestCharacter], CAST(JSON_VALUE([j].[Reference],'$.TestDateTime') AS datetime2) AS [TestDateTime], CAST(JSON_VALUE([j].[Reference],'$.TestDateTimeOffset') AS datetimeoffset) AS [TestDateTimeOffset], CAST(JSON_VALUE([j].[Reference],'$.TestDecimal') AS decimal(18,3)) AS [TestDecimal], CAST(JSON_VALUE([j].[Reference],'$.TestDouble') AS float) AS [TestDouble], CAST(JSON_VALUE([j].[Reference],'$.TestGuid') AS uniqueidentifier) AS [TestGuid], CAST(JSON_VALUE([j].[Reference],'$.TestInt16') AS smallint) AS [TestInt16], CAST(JSON_VALUE([j].[Reference],'$.TestInt32') AS int) AS [TestInt32], CAST(JSON_VALUE([j].[Reference],'$.TestInt64') AS bigint) AS [TestInt64], CAST(JSON_VALUE([j].[Reference],'$.TestSignedByte') AS smallint) AS [TestSignedByte], CAST(JSON_VALUE([j].[Reference],'$.TestSingle') AS real) AS [TestSingle], CAST(JSON_VALUE([j].[Reference],'$.TestTimeSpan') AS time) AS [TestTimeSpan], CAST(JSON_VALUE([j].[Reference],'$.TestUnsignedInt16') AS int) AS [TestUnsignedInt16], CAST(JSON_VALUE([j].[Reference],'$.TestUnsignedInt32') AS bigint) AS [TestUnsignedInt32], CAST(JSON_VALUE([j].[Reference],'$.TestUnsignedInt64') AS decimal(20,0)) AS [TestUnsignedInt64], CAST(JSON_VALUE([j].[Reference],'$.TestNullableInt32') AS int) AS [TestNullableInt32], CAST(JSON_VALUE([j].[Reference],'$.TestEnum') AS nvarchar(max)) AS [TestEnum], CAST(JSON_VALUE([j].[Reference],'$.TestEnumWithIntConverter') AS int) AS [TestEnumWithIntConverter], CAST(JSON_VALUE([j].[Reference],'$.TestNullableEnum') AS nvarchar(max)) AS [TestNullableEnum], CAST(JSON_VALUE([j].[Reference],'$.TestNullableEnumWithIntConverter') AS int) AS [TestNullableEnumWithIntConverter], CAST(JSON_VALUE([j].[Reference],'$.TestNullableEnumWithConverterThatHandlesNulls') AS nvarchar(max)) AS [TestNullableEnumWithConverterThatHandlesNulls] -FROM [JsonEntitiesAllTypes] AS [j] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_basic(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesBasic] AS j")), - ss => ss.Set(), - entryCount: 40); - - AssertSql( -""" -SELECT [m].[Id], [m].[EntityBasicId], [m].[Name], JSON_QUERY([m].[OwnedCollectionRoot],'$'), JSON_QUERY([m].[OwnedReferenceRoot],'$') -FROM ( - SELECT * FROM "JsonEntitiesBasic" AS j -) AS [m] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task FromSqlInterpolated_on_entity_with_json_with_predicate(bool async) - { - var parameter = new OleDbParameter { ParameterName = "prm", Value = 1 }; - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSql( - Fixture.TestStore.NormalizeDelimitersInInterpolatedString($"SELECT * FROM [JsonEntitiesBasic] AS j WHERE [j].[Id] = {parameter}")), - ss => ss.Set(), - entryCount: 40); - - AssertSql( -""" -prm='1' - -SELECT [m].[Id], [m].[EntityBasicId], [m].[Name], JSON_QUERY([m].[OwnedCollectionRoot],'$'), JSON_QUERY([m].[OwnedReferenceRoot],'$') -FROM ( - SELECT * FROM "JsonEntitiesBasic" AS j WHERE "j"."Id" = @prm -) AS [m] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_project_json_reference(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesBasic] AS j")) - .AsNoTracking() - .Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch), - ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch)); - - AssertSql( -""" -SELECT JSON_QUERY([m].[OwnedReferenceRoot],'$.OwnedReferenceBranch'), [m].[Id] -FROM ( - SELECT * FROM "JsonEntitiesBasic" AS j -) AS [m] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_project_json_collection(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesBasic] AS j")) - .AsNoTracking() - .Select(x => x.OwnedReferenceRoot.OwnedCollectionBranch), - ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedCollectionBranch), - elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => (ee.Date, ee.Enum, ee.Fraction))); - - AssertSql( -""" -SELECT JSON_QUERY([m].[OwnedReferenceRoot],'$.OwnedCollectionBranch'), [m].[Id] -FROM ( - SELECT * FROM "JsonEntitiesBasic" AS j -) AS [m] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_inheritance_on_base(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesInheritance] AS j")), - ss => ss.Set(), - entryCount: 38); - - AssertSql( -""" -SELECT [m].[Id], [m].[Discriminator], [m].[Name], [m].[Fraction], JSON_QUERY([m].[CollectionOnBase],'$'), JSON_QUERY([m].[ReferenceOnBase],'$'), JSON_QUERY([m].[CollectionOnDerived],'$'), JSON_QUERY([m].[ReferenceOnDerived],'$') -FROM ( - SELECT * FROM "JsonEntitiesInheritance" AS j -) AS [m] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_inheritance_on_derived(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesInheritance] AS j")), - ss => ss.Set(), - entryCount: 25); - - AssertSql( -""" -SELECT [m].[Id], [m].[Discriminator], [m].[Name], [m].[Fraction], JSON_QUERY([m].[CollectionOnBase],'$'), JSON_QUERY([m].[ReferenceOnBase],'$'), JSON_QUERY([m].[CollectionOnDerived],'$'), JSON_QUERY([m].[ReferenceOnDerived],'$') -FROM ( - SELECT * FROM "JsonEntitiesInheritance" AS j -) AS [m] -WHERE [m].[Discriminator] = N'JsonEntityInheritanceDerived' -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_inheritance_project_reference_on_base(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesInheritance] AS j")) - .AsNoTracking() - .OrderBy(x => x.Id) - .Select(x => x.ReferenceOnBase), - ss => ss.Set().OrderBy(x => x.Id).Select(x => x.ReferenceOnBase), - assertOrder: true); - - AssertSql( -""" -SELECT JSON_QUERY([m].[ReferenceOnBase],'$'), [m].[Id] -FROM ( - SELECT * FROM "JsonEntitiesInheritance" AS j -) AS [m] -ORDER BY [m].[Id] -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task FromSql_on_entity_with_json_inheritance_project_reference_on_derived(bool async) - { - await AssertQuery( - async, - ss => ((DbSet)ss.Set()).FromSqlRaw( - Fixture.TestStore.NormalizeDelimitersInRawString("SELECT * FROM [JsonEntitiesInheritance] AS j")) - .AsNoTracking() - .OrderBy(x => x.Id) - .Select(x => x.CollectionOnDerived), - ss => ss.Set().OrderBy(x => x.Id).Select(x => x.CollectionOnDerived), - elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => (ee.Date, ee.Enum, ee.Fraction)), - assertOrder: true); - - AssertSql( -""" -SELECT JSON_QUERY([m].[CollectionOnDerived],'$'), [m].[Id] -FROM ( - SELECT * FROM "JsonEntitiesInheritance" AS j -) AS [m] -WHERE [m].[Discriminator] = N'JsonEntityInheritanceDerived' -ORDER BY [m].[Id] -"""); - } - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs index 4933a95..e824274 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs @@ -14,7 +14,7 @@ using Xunit; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class OperatorsQuerySqlServerTest : OperatorsQueryTestBase +public class OperatorsQueryJetTest : OperatorsQueryTestBase { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Update/JsonUpdateJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Update/JsonUpdateJetFixture.cs deleted file mode 100644 index c2f005f..0000000 --- a/test/EFCore.Jet.FunctionalTests/Update/JsonUpdateJetFixture.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore.TestUtilities; -using Microsoft.EntityFrameworkCore.Update; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Update; - -public class JsonUpdateJetFixture : JsonUpdateFixtureBase -{ - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; -} diff --git a/test/EFCore.Jet.FunctionalTests/Update/JsonUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/JsonUpdateJetTest.cs deleted file mode 100644 index 37492c3..0000000 --- a/test/EFCore.Jet.FunctionalTests/Update/JsonUpdateJetTest.cs +++ /dev/null @@ -1,1248 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Threading.Tasks; -using EntityFrameworkCore.Jet.FunctionalTests.Update; -using Microsoft.EntityFrameworkCore.Update; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Update; - -public class JsonUpdateJetTest : JsonUpdateTestBase -{ - public JsonUpdateJetTest(JsonUpdateJetFixture fixture) - : base(fixture) - { - ClearLog(); - } - - public override async Task Add_element_to_json_collection_branch() - { - await base.Add_element_to_json_collection_branch(); - - AssertSql( -""" -@p0='[{"Date":"2101-01-01T00:00:00","Enum":"Two","Fraction":10.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":"Three","Fraction":10.2,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}},{"Date":"2010-10-10T00:00:00","Enum":"Three","Fraction":42.42,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}]' (Nullable = false) (Size = 684) -@p1='1' - -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Add_element_to_json_collection_leaf() - { - await base.Add_element_to_json_collection_leaf(); - - AssertSql( -""" -@p0='[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"},{"SomethingSomething":"ss1"}]' (Nullable = false) (Size = 100) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Add_element_to_json_collection_on_derived() - { - await base.Add_element_to_json_collection_on_derived(); - - AssertSql( -""" -@p0='[{"Date":"2221-01-01T00:00:00","Enum":"Two","Fraction":221.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"d2_r_c1"},{"SomethingSomething":"d2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"d2_r_r"}},{"Date":"2222-01-01T00:00:00","Enum":"Three","Fraction":222.1,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"d2_r_c1"},{"SomethingSomething":"d2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"d2_r_r"}},{"Date":"2010-10-10T00:00:00","Enum":"Three","Fraction":42.42,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}]' (Nullable = false) (Size = 668) -@p1='2' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesInheritance] SET [CollectionOnDerived] = @p0 -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[Discriminator], [j].[Name], [j].[Fraction], JSON_QUERY([j].[CollectionOnBase],'$'), JSON_QUERY([j].[ReferenceOnBase],'$'), JSON_QUERY([j].[CollectionOnDerived],'$'), JSON_QUERY([j].[ReferenceOnDerived],'$') -FROM [JsonEntitiesInheritance] AS [j] -WHERE [j].[Discriminator] = N'JsonEntityInheritanceDerived' -"""); - } - - public override async Task Add_element_to_json_collection_root() - { - await base.Add_element_to_json_collection_root(); - - AssertSql( -""" -@p0='[{"Name":"e1_c1","Number":11,"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":"Two","Fraction":11.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":"Three","Fraction":11.2,"NullableEnum":"Two","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":"One","Fraction":11.0,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Name":"e1_c2","Number":12,"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":"Two","Fraction":12.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":"One","Fraction":12.2,"NullableEnum":null,"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":"Three","Fraction":12.0,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}},{"Name":"new Name","Number":142,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":"Three","Fraction":42.42,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}]' (Nullable = false) (Size = 1867) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = @p0 -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Add_entity_with_json() - { - await base.Add_entity_with_json(); - - AssertSql( -""" -@p0='{"Name":"RootName","Number":42,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":"Three","Fraction":42.42,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}' (Nullable = false) (Size = 296) -@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 [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Add_json_reference_leaf() - { - await base.Add_json_reference_leaf(); - - AssertSql( -""" -@p0='{"SomethingSomething":"ss3"}' (Nullable = false) (Size = 28) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Add_json_reference_root() - { - await base.Add_json_reference_root(); - - AssertSql( -""" -@p0='{"Name":"RootName","Number":42,"OwnedCollectionBranch":[],"OwnedReferenceBranch":{"Date":"2010-10-10T00:00:00","Enum":"Three","Fraction":42.42,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"ss1"},{"SomethingSomething":"ss2"}],"OwnedReferenceLeaf":{"SomethingSomething":"ss3"}}}' (Nullable = false) (Size = 296) -@p1='1' - -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Delete_entity_with_json() - { - await base.Delete_entity_with_json(); - - AssertSql( -""" -@p0='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -DELETE FROM [JsonEntitiesBasic] -OUTPUT 1 -WHERE [Id] = @p0; -""", - // -""" -SELECT COUNT(*) -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Delete_json_collection_branch() - { - await base.Delete_json_collection_branch(); - - AssertSql( -""" -@p0='[]' (Nullable = false) (Size = 2) -@p1='1' - -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Delete_json_collection_root() - { - await base.Delete_json_collection_root(); - - AssertSql( -""" -@p0='[]' (Nullable = false) (Size = 2) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = @p0 -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Delete_json_reference_leaf() - { - await base.Delete_json_reference_leaf(); - - AssertSql( -""" -@p0=NULL (Nullable = false) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Delete_json_reference_root() - { - await base.Delete_json_reference_root(); - - AssertSql( -""" -@p0=NULL (Nullable = false) -@p1='1' - -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_element_in_json_collection_branch() - { - await base.Edit_element_in_json_collection_branch(); - - AssertSql( -""" -@p0='["2111-11-11T00:00:00"]' (Nullable = false) (Size = 23) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[0].OwnedCollectionBranch[0].Date', JSON_VALUE(@p0, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_element_in_json_collection_root1() - { - await base.Edit_element_in_json_collection_root1(); - - AssertSql( -""" -@p0='["Modified"]' (Nullable = false) (Size = 12) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[0].Name', JSON_VALUE(@p0, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_element_in_json_collection_root2() - { - await base.Edit_element_in_json_collection_root2(); - - AssertSql( -""" -@p0='["Modified"]' (Nullable = false) (Size = 12) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Name', JSON_VALUE(@p0, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_element_in_json_multiple_levels_partial_update() - { - await base.Edit_element_in_json_multiple_levels_partial_update(); - - AssertSql( -""" -@p0='[{"Date":"2111-01-01T00:00:00","Enum":"Two","Fraction":11.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"...and another"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":"Three","Fraction":11.2,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"yet another change"},{"SomethingSomething":"and another"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c2_r"}}]' (Nullable = false) (Size = 485) -@p1='{"Name":"edit","Number":10,"OwnedCollectionBranch":[{"Date":"2101-01-01T00:00:00","Enum":"Two","Fraction":10.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":"Three","Fraction":10.2,"NullableEnum":"Two","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":"One","Fraction":10.0,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_r_r"}}}' (Nullable = false) (Size = 773) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_element_in_json_branch_collection_and_add_element_to_the_same_collection() - { - await base.Edit_element_in_json_branch_collection_and_add_element_to_the_same_collection(); - - AssertSql( -""" -@p0='[{"Date":"2101-01-01T00:00:00","Enum":"Two","Fraction":4321.3,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c1_c1"},{"SomethingSomething":"e1_r_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c1_r"}},{"Date":"2102-01-01T00:00:00","Enum":"Three","Fraction":10.2,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_c2_c1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_c2_r"}},{"Date":"2222-11-11T00:00:00","Enum":"Three","Fraction":45.32,"NullableEnum":null,"OwnedCollectionLeaf":[],"OwnedReferenceLeaf":{"SomethingSomething":"cc"}}]' (Nullable = false) (Size = 628) -@p1='1' - -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_two_elements_in_the_same_json_collection() - { - await base.Edit_two_elements_in_the_same_json_collection(); - - AssertSql( -""" -@p0='[{"SomethingSomething":"edit1"},{"SomethingSomething":"edit2"}]' (Nullable = false) (Size = 63) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_two_elements_in_the_same_json_collection_at_the_root() - { - await base.Edit_two_elements_in_the_same_json_collection_at_the_root(); - - AssertSql( -""" -@p0='[{"Name":"edit1","Number":11,"OwnedCollectionBranch":[{"Date":"2111-01-01T00:00:00","Enum":"Two","Fraction":11.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_c1_c1"},{"SomethingSomething":"e1_c1_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_c1_r"}},{"Date":"2112-01-01T00:00:00","Enum":"Three","Fraction":11.2,"NullableEnum":"Two","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":"One","Fraction":11.0,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"e1_c1_r_c1"},{"SomethingSomething":"e1_c1_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c1_r_r"}}},{"Name":"edit2","Number":12,"OwnedCollectionBranch":[{"Date":"2121-01-01T00:00:00","Enum":"Two","Fraction":12.1,"NullableEnum":"One","OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_c1_c1"},{"SomethingSomething":"e1_c2_c1_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_c1_r"}},{"Date":"2122-01-01T00:00:00","Enum":"One","Fraction":12.2,"NullableEnum":null,"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":"Three","Fraction":12.0,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"e1_c2_r_c1"},{"SomethingSomething":"e1_c2_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_c2_r_r"}}}]' (Nullable = false) (Size = 1569) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = @p0 -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_collection_element_and_reference_at_once() - { - await base.Edit_collection_element_and_reference_at_once(); - - AssertSql( -""" -@p0='{"Date":"2102-01-01T00:00:00","Enum":"Three","Fraction":10.2,"NullableEnum":"Two","OwnedCollectionLeaf":[{"SomethingSomething":"edit1"},{"SomethingSomething":"e1_r_c2_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit2"}}' (Nullable = false) (Size = 225) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_single_enum_property() - { - await base.Edit_single_enum_property(); - - AssertSql( -""" -@p0='["Two"]' (Nullable = false) (Size = 7) -@p1='["Two"]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].OwnedCollectionBranch[1].Enum', JSON_VALUE(@p0, '$[0]')), [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch.Enum', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_single_numeric_property() - { - await base.Edit_single_numeric_property(); - - AssertSql( -""" -@p0='[1024]' (Nullable = false) (Size = 6) -@p1='[999]' (Nullable = false) (Size = 5) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Number', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.Number', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_single_property_bool() - { - await base.Edit_single_property_bool(); - - AssertSql( -""" -@p0='[true]' (Nullable = false) (Size = 6) -@p1='[false]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestBoolean', CAST(JSON_VALUE(@p0, '$[0]') AS bit)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestBoolean', CAST(JSON_VALUE(@p1, '$[0]') AS bit)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_byte() - { - await base.Edit_single_property_byte(); - - AssertSql( -""" -@p0='[14]' (Nullable = false) (Size = 4) -@p1='[25]' (Nullable = false) (Size = 4) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestByte', CAST(JSON_VALUE(@p0, '$[0]') AS tinyint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestByte', CAST(JSON_VALUE(@p1, '$[0]') AS tinyint)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_char() - { - await base.Edit_single_property_char(); - - AssertSql( -""" -@p0='["t"]' (Nullable = false) (Size = 5) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Reference] = JSON_MODIFY([Reference], 'strict $.TestCharacter', JSON_VALUE(@p0, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p1; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_datetime() - { - await base.Edit_single_property_datetime(); - - AssertSql( -""" -@p0='["3000-01-01T12:34:56"]' (Nullable = false) (Size = 23) -@p1='["3000-01-01T12:34:56"]' (Nullable = false) (Size = 23) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateTime', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateTime', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_datetimeoffset() - { - await base.Edit_single_property_datetimeoffset(); - - AssertSql( -""" -@p0='["3000-01-01T12:34:56-04:00"]' (Nullable = false) (Size = 29) -@p1='["3000-01-01T12:34:56-04:00"]' (Nullable = false) (Size = 29) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateTimeOffset', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateTimeOffset', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_decimal() - { - await base.Edit_single_property_decimal(); - - AssertSql( -""" -@p0='[-13579.01]' (Nullable = false) (Size = 11) -@p1='[-13579.01]' (Nullable = false) (Size = 11) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDecimal', CAST(JSON_VALUE(@p0, '$[0]') AS decimal(18,3))), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDecimal', CAST(JSON_VALUE(@p1, '$[0]') AS decimal(18,3))) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_double() - { - await base.Edit_single_property_double(); - - AssertSql( -""" -@p0='[-1.23579]' (Nullable = false) (Size = 10) -@p1='[-1.23579]' (Nullable = false) (Size = 10) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDouble', CAST(JSON_VALUE(@p0, '$[0]') AS float)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDouble', CAST(JSON_VALUE(@p1, '$[0]') AS float)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_guid() - { - await base.Edit_single_property_guid(); - - AssertSql( -""" -@p0='["12345678-1234-4321-5555-987654321000"]' (Nullable = false) (Size = 40) -@p1='["12345678-1234-4321-5555-987654321000"]' (Nullable = false) (Size = 40) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestGuid', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestGuid', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_int16() - { - await base.Edit_single_property_int16(); - - AssertSql( -""" -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt16', CAST(JSON_VALUE(@p0, '$[0]') AS smallint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt16', CAST(JSON_VALUE(@p1, '$[0]') AS smallint)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_int32() - { - await base.Edit_single_property_int32(); - - AssertSql( -""" -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt32', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt32', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_int64() - { - await base.Edit_single_property_int64(); - - AssertSql( -""" -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt64', CAST(JSON_VALUE(@p0, '$[0]') AS bigint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt64', CAST(JSON_VALUE(@p1, '$[0]') AS bigint)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_signed_byte() - { - await base.Edit_single_property_signed_byte(); - - AssertSql( -""" -@p0='[-108]' (Nullable = false) (Size = 6) -@p1='[-108]' (Nullable = false) (Size = 6) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestSignedByte', CAST(JSON_VALUE(@p0, '$[0]') AS smallint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestSignedByte', CAST(JSON_VALUE(@p1, '$[0]') AS smallint)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_single() - { - await base.Edit_single_property_single(); - - AssertSql( -""" -@p0='[-7.234]' (Nullable = false) (Size = 8) -@p1='[-7.234]' (Nullable = false) (Size = 8) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestSingle', CAST(JSON_VALUE(@p0, '$[0]') AS real)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestSingle', CAST(JSON_VALUE(@p1, '$[0]') AS real)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_timespan() - { - await base.Edit_single_property_timespan(); - - AssertSql( -""" -@p0='["10:01:01.0070000"]' (Nullable = false) (Size = 20) -@p1='["10:01:01.0070000"]' (Nullable = false) (Size = 20) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestTimeSpan', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestTimeSpan', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_uint16() - { - await base.Edit_single_property_uint16(); - - AssertSql( -""" -@p0='[1534]' (Nullable = false) (Size = 6) -@p1='[1534]' (Nullable = false) (Size = 6) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt16', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt16', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_uint32() - { - await base.Edit_single_property_uint32(); - - AssertSql( -""" -@p0='[1237775789]' (Nullable = false) (Size = 12) -@p1='[1237775789]' (Nullable = false) (Size = 12) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt32', CAST(JSON_VALUE(@p0, '$[0]') AS bigint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt32', CAST(JSON_VALUE(@p1, '$[0]') AS bigint)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_uint64() - { - await base.Edit_single_property_uint64(); - - AssertSql( -""" -@p0='[1234555555123456789]' (Nullable = false) (Size = 21) -@p1='[1234555555123456789]' (Nullable = false) (Size = 21) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt64', CAST(JSON_VALUE(@p0, '$[0]') AS decimal(20,0))), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt64', CAST(JSON_VALUE(@p1, '$[0]') AS decimal(20,0))) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_int32() - { - await base.Edit_single_property_nullable_int32(); - - AssertSql( -""" -@p0='[122354]' (Nullable = false) (Size = 8) -@p1='[64528]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableInt32', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableInt32', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_int32_set_to_null() - { - await base.Edit_single_property_nullable_int32_set_to_null(); - - AssertSql( -""" -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableInt32', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableInt32', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_enum() - { - await base.Edit_single_property_enum(); - - AssertSql( -""" -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnum', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnum', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_enum_with_int_converter() - { - await base.Edit_single_property_enum_with_int_converter(); - - AssertSql( -""" -@p0='[2]' (Nullable = false) (Size = 3) -@p1='[2]' (Nullable = false) (Size = 3) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumWithIntConverter', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumWithIntConverter', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_enum() - { - await base.Edit_single_property_nullable_enum(); - - AssertSql( -""" -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnum', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnum', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_enum_set_to_null() - { - await base.Edit_single_property_nullable_enum_set_to_null(); - - AssertSql( -""" -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnum', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnum', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_enum_with_int_converter() - { - await base.Edit_single_property_nullable_enum_with_int_converter(); - - AssertSql( -""" -@p0='[0]' (Nullable = false) (Size = 3) -@p1='[2]' (Nullable = false) (Size = 3) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_enum_with_int_converter_set_to_null() - { - await base.Edit_single_property_nullable_enum_with_int_converter_set_to_null(); - - AssertSql( -""" -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', CAST(JSON_VALUE(@p0, '$[0]') AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', CAST(JSON_VALUE(@p1, '$[0]') AS int)) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_enum_with_converter_that_handles_nulls() - { - await base.Edit_single_property_nullable_enum_with_converter_that_handles_nulls(); - - AssertSql( -""" -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["One"]' (Nullable = false) (Size = 7) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithConverterThatHandlesNulls', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithConverterThatHandlesNulls', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_single_property_nullable_enum_with_converter_that_handles_nulls_set_to_null() - { - await base.Edit_single_property_nullable_enum_with_converter_that_handles_nulls_set_to_null(); - - AssertSql( -""" -@p0='["Null"]' (Nullable = false) (Size = 8) -@p1='["Null"]' (Nullable = false) (Size = 8) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithConverterThatHandlesNulls', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithConverterThatHandlesNulls', JSON_VALUE(@p1, '$[0]')) -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([j].[Reference],'$') -FROM [JsonEntitiesAllTypes] AS [j] -WHERE [j].[Id] = 1 -"""); - } - - public override async Task Edit_two_properties_on_same_entity_updates_the_entire_entity() - { - await base.Edit_two_properties_on_same_entity_updates_the_entire_entity(); - - AssertSql( -""" -@p0='{"TestBoolean":false,"TestByte":25,"TestCharacter":"h","TestDateTime":"2100-11-11T12:34:56","TestDateTimeOffset":"2200-11-11T12:34:56-05:00","TestDecimal":-123450.01,"TestDouble":-1.2345,"TestEnum":"One","TestEnumWithIntConverter":1,"TestGuid":"00000000-0000-0000-0000-000000000000","TestInt16":-12,"TestInt32":32,"TestInt64":64,"TestNullableEnum":"One","TestNullableEnumWithConverterThatHandlesNulls":"Two","TestNullableEnumWithIntConverter":2,"TestNullableInt32":90,"TestSignedByte":-18,"TestSingle":-1.4,"TestTimeSpan":"06:05:04.0030000","TestUnsignedInt16":12,"TestUnsignedInt32":12345,"TestUnsignedInt64":1234567867}' (Nullable = false) (Size = 621) -@p1='{"TestBoolean":true,"TestByte":255,"TestCharacter":"a","TestDateTime":"2000-01-01T12:34:56","TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDecimal":-1234567890.01,"TestDouble":-1.23456789,"TestEnum":"One","TestEnumWithIntConverter":1,"TestGuid":"12345678-1234-4321-7777-987654321000","TestInt16":-1234,"TestInt32":32,"TestInt64":64,"TestNullableEnum":"One","TestNullableEnumWithConverterThatHandlesNulls":"Three","TestNullableEnumWithIntConverter":1,"TestNullableInt32":78,"TestSignedByte":-128,"TestSingle":-1.234,"TestTimeSpan":"10:09:08.0070000","TestUnsignedInt16":1234,"TestUnsignedInt32":1234565789,"TestUnsignedInt64":1234567890123456789}' (Nullable = false) (Size = 652) -@p2='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0]', JSON_QUERY(@p0)), [Reference] = @p1 -OUTPUT 1 -WHERE [Id] = @p2; -""", - // -""" -SELECT TOP(2) [j].[Id], JSON_QUERY([j].[Collection],'$'), JSON_QUERY([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() - { - await base.Edit_a_scalar_property_and_reference_navigation_on_the_same_entity(); - - AssertSql( -""" -@p0='{"Date":"2100-01-01T00:00:00","Enum":"One","Fraction":523.532,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit"}}' (Nullable = false) (Size = 227) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_a_scalar_property_and_collection_navigation_on_the_same_entity() - { - await base.Edit_a_scalar_property_and_collection_navigation_on_the_same_entity(); - - AssertSql( -""" -@p0='{"Date":"2100-01-01T00:00:00","Enum":"One","Fraction":523.532,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"edit"}],"OwnedReferenceLeaf":{"SomethingSomething":"e1_r_r_r"}}' (Nullable = false) (Size = 191) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - public override async Task Edit_a_scalar_property_and_another_property_behind_reference_navigation_on_the_same_entity() - { - 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":"One","Fraction":523.532,"NullableEnum":null,"OwnedCollectionLeaf":[{"SomethingSomething":"e1_r_r_c1"},{"SomethingSomething":"e1_r_r_c2"}],"OwnedReferenceLeaf":{"SomethingSomething":"edit"}}' (Nullable = false) (Size = 227) -@p1='1' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -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], JSON_QUERY([j].[OwnedCollectionRoot],'$'), JSON_QUERY([j].[OwnedReferenceRoot],'$') -FROM [JsonEntitiesBasic] AS [j] -"""); - } - - protected override void ClearLog() - => Fixture.TestSqlLoggerFactory.Clear(); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); -}