diff --git a/test/EFCore.Relational.Specification.Tests/Query/JsonQueryFixtureBase.cs b/test/EFCore.Relational.Specification.Tests/Query/JsonQueryFixtureBase.cs index 8347fb60c35..bc11470d327 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/JsonQueryFixtureBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/JsonQueryFixtureBase.cs @@ -560,6 +560,27 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con b.ToJson(); b.Property(x => x.TestMaxLengthString).HasMaxLength(5); b.Property(x => x.TestDecimal).HasPrecision(18, 3); + b.Property(x => x.TestEnumWithIntConverter).HasConversion(); + b.Property(x => x.TestNullableEnumWithIntConverter).HasConversion(); + b.Property(x => x.TestNullableEnumWithConverterThatHandlesNulls).HasConversion( + new ValueConverter( + x => x == null + ? "Null" + : x == JsonEnum.One + ? "One" + : x == JsonEnum.Two + ? "Two" + : x == JsonEnum.Three + ? "Three" + : "INVALID", + x => x == "One" + ? JsonEnum.One + : x == "Two" + ? JsonEnum.Two + : x == "Three" + ? JsonEnum.Three + : null, + convertsNulls: true)); }); modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); diff --git a/test/EFCore.Relational.Specification.Tests/Update/JsonUpdateFixtureBase.cs b/test/EFCore.Relational.Specification.Tests/Update/JsonUpdateFixtureBase.cs index 8c0ace8bb94..c6b108148b0 100644 --- a/test/EFCore.Relational.Specification.Tests/Update/JsonUpdateFixtureBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Update/JsonUpdateFixtureBase.cs @@ -115,13 +115,57 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con x => x.Reference, b => { b.ToJson(); + b.Property(x => x.TestMaxLengthString).HasMaxLength(5); b.Property(x => x.TestDecimal).HasPrecision(18, 3); + b.Property(x => x.TestEnumWithIntConverter).HasConversion(); + b.Property(x => x.TestNullableEnumWithIntConverter).HasConversion(); + b.Property(x => x.TestNullableEnumWithConverterThatHandlesNulls).HasConversion( + new ValueConverter( + x => x == null + ? "Null" + : x == JsonEnum.One + ? "One" + : x == JsonEnum.Two + ? "Two" + : x == JsonEnum.Three + ? "Three" + : "INVALID", + x => x == "One" + ? JsonEnum.One + : x == "Two" + ? JsonEnum.Two + : x == "Three" + ? JsonEnum.Three + : null, + convertsNulls: true)); }); modelBuilder.Entity().OwnsMany( x => x.Collection, b => { b.ToJson(); + b.Property(x => x.TestMaxLengthString).HasMaxLength(5); b.Property(x => x.TestDecimal).HasPrecision(18, 3); + b.Property(x => x.TestEnumWithIntConverter).HasConversion(); + b.Property(x => x.TestNullableEnumWithIntConverter).HasConversion(); + b.Property(x => x.TestNullableEnumWithConverterThatHandlesNulls).HasConversion( + new ValueConverter( + x => x == null + ? "Null" + : x == JsonEnum.One + ? "One" + : x == JsonEnum.Two + ? "Two" + : x == JsonEnum.Three + ? "Three" + : "INVALID", + x => x == "One" + ? JsonEnum.One + : x == "Two" + ? JsonEnum.Two + : x == "Three" + ? JsonEnum.Three + : null, + convertsNulls: true)); }); modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); diff --git a/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs index 8ee8874e2ec..fa14c837705 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs @@ -26,8 +26,8 @@ public override async Task Add_element_to_json_collection_branch() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -48,8 +48,8 @@ public override async Task Add_element_to_json_collection_leaf() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -70,8 +70,8 @@ public override async Task Add_element_to_json_collection_on_derived() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Discriminator], [j].[Name], [j].[Fraction], [j].[CollectionOnBase], [j].[ReferenceOnBase], [j].[CollectionOnDerived], [j].[ReferenceOnDerived] FROM [JsonEntitiesInheritance] AS [j] WHERE [j].[Discriminator] = N'JsonEntityInheritanceDerived' @@ -93,8 +93,8 @@ public override async Task Add_element_to_json_collection_root() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -116,8 +116,8 @@ public override async Task Add_entity_with_json() INSERT INTO [JsonEntitiesBasic] ([OwnedReferenceRoot], [Id], [EntityBasicId], [Name]) VALUES (@p0, @p1, @p2, @p3); """, - // - """ + // +""" SELECT [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -138,8 +138,8 @@ public override async Task Add_json_reference_leaf() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -160,8 +160,8 @@ public override async Task Add_json_reference_root() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -203,8 +203,8 @@ public override async Task Delete_json_collection_branch() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -225,8 +225,8 @@ public override async Task Delete_json_collection_root() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -247,8 +247,8 @@ public override async Task Delete_json_reference_leaf() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -269,8 +269,8 @@ public override async Task Delete_json_reference_root() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -291,8 +291,8 @@ public override async Task Edit_element_in_json_collection_branch() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -313,8 +313,8 @@ public override async Task Edit_element_in_json_collection_root1() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -335,8 +335,8 @@ public override async Task Edit_element_in_json_collection_root2() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -358,8 +358,8 @@ public override async Task Edit_element_in_json_multiple_levels_partial_update() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -380,8 +380,8 @@ public override async Task Edit_element_in_json_branch_collection_and_add_elemen OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -402,8 +402,8 @@ public override async Task Edit_two_elements_in_the_same_json_collection() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -424,8 +424,8 @@ public override async Task Edit_two_elements_in_the_same_json_collection_at_the_ OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -446,8 +446,8 @@ public override async Task Edit_collection_element_and_reference_at_once() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -469,8 +469,8 @@ public override async Task Edit_single_enum_property() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -492,8 +492,8 @@ public override async Task Edit_single_numeric_property() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -515,8 +515,8 @@ public override async Task Edit_single_property_bool() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -539,8 +539,8 @@ public override async Task Edit_single_property_byte() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -562,8 +562,8 @@ public override async Task Edit_single_property_char() OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -586,8 +586,8 @@ public override async Task Edit_single_property_datetime() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -610,8 +610,8 @@ public override async Task Edit_single_property_datetimeoffset() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -634,8 +634,8 @@ public override async Task Edit_single_property_decimal() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -658,8 +658,8 @@ public override async Task Edit_single_property_double() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -682,8 +682,8 @@ public override async Task Edit_single_property_guid() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -706,8 +706,8 @@ public override async Task Edit_single_property_int16() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -730,8 +730,8 @@ public override async Task Edit_single_property_int32() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -754,8 +754,8 @@ public override async Task Edit_single_property_int64() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -778,8 +778,8 @@ public override async Task Edit_single_property_signed_byte() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -802,8 +802,8 @@ public override async Task Edit_single_property_single() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -826,8 +826,8 @@ public override async Task Edit_single_property_timespan() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -850,8 +850,8 @@ public override async Task Edit_single_property_uint16() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -874,8 +874,8 @@ public override async Task Edit_single_property_uint32() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -898,8 +898,8 @@ public override async Task Edit_single_property_uint64() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -922,8 +922,8 @@ public override async Task Edit_single_property_nullable_int32() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -946,8 +946,8 @@ public override async Task Edit_single_property_nullable_int32_set_to_null() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -970,8 +970,8 @@ public override async Task Edit_single_property_enum() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -984,18 +984,18 @@ public override async Task Edit_single_property_enum_with_int_converter() AssertSql( """ -@p0='Three' (Nullable = false) (Size = 5) -@p1='Three' (Nullable = false) (Size = 5) +@p0='2' (DbType = String) +@p1='2' (DbType = String) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumWithIntConverter', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumWithIntConverter', @p1) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumWithIntConverter', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumWithIntConverter', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1018,8 +1018,8 @@ public override async Task Edit_single_property_nullable_enum() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1042,8 +1042,8 @@ public override async Task Edit_single_property_nullable_enum_set_to_null() OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1056,18 +1056,18 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter AssertSql( """ -@p0='One' (Nullable = false) (Size = 3) -@p1='Three' (Nullable = false) (Size = 5) +@p0='0' (DbType = String) +@p1='2' (DbType = String) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', @p1) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1086,12 +1086,12 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', @p1) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1114,8 +1114,8 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1128,8 +1128,8 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha AssertSql( """ -@p0=NULL (Nullable = false) -@p1=NULL (Nullable = false) +@p0='Null' (Nullable = false) (Size = 4) +@p1='Null' (Nullable = false) (Size = 4) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -1138,8 +1138,8 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1152,8 +1152,8 @@ public override async Task Edit_two_properties_on_same_entity_updates_the_entire 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,"TestDefaultString":"MyDefaultStringInCollection1","TestDouble":-1.2345,"TestEnum":"One","TestEnumWithIntConverter":"Two","TestGuid":"00000000-0000-0000-0000-000000000000","TestInt16":-12,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Baz","TestNullableEnum":"One","TestNullableEnumWithConverterThatHandlesNulls":"Two","TestNullableEnumWithIntConverter":"Three","TestNullableInt32":90,"TestSignedByte":-18,"TestSingle":-1.4,"TestTimeSpan":"06:05:04.0030000","TestUnsignedInt16":12,"TestUnsignedInt32":12345,"TestUnsignedInt64":1234567867}' (Nullable = false) (Size = 710) -@p1='{"TestBoolean":true,"TestByte":255,"TestCharacter":"a","TestDateTime":"2000-01-01T12:34:56","TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDecimal":-1234567890.01,"TestDefaultString":"MyDefaultStringInReference1","TestDouble":-1.23456789,"TestEnum":"One","TestEnumWithIntConverter":"Two","TestGuid":"12345678-1234-4321-7777-987654321000","TestInt16":-1234,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Foo","TestNullableEnum":"One","TestNullableEnumWithConverterThatHandlesNulls":"Three","TestNullableEnumWithIntConverter":"Two","TestNullableInt32":78,"TestSignedByte":-128,"TestSingle":-1.234,"TestTimeSpan":"10:09:08.0070000","TestUnsignedInt16":1234,"TestUnsignedInt32":1234565789,"TestUnsignedInt64":1234567890123456789}' (Nullable = false) (Size = 738) +@p0='{"TestBoolean":false,"TestByte":25,"TestCharacter":"h","TestDateTime":"2100-11-11T12:34:56","TestDateTimeOffset":"2200-11-11T12:34:56-05:00","TestDecimal":-123450.01,"TestDefaultString":"MyDefaultStringInCollection1","TestDouble":-1.2345,"TestEnum":"One","TestEnumWithIntConverter":1,"TestGuid":"00000000-0000-0000-0000-000000000000","TestInt16":-12,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Baz","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 = 700) +@p1='{"TestBoolean":true,"TestByte":255,"TestCharacter":"a","TestDateTime":"2000-01-01T12:34:56","TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDecimal":-1234567890.01,"TestDefaultString":"MyDefaultStringInReference1","TestDouble":-1.23456789,"TestEnum":"One","TestEnumWithIntConverter":1,"TestGuid":"12345678-1234-4321-7777-987654321000","TestInt16":-1234,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Foo","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 = 730) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; @@ -1162,8 +1162,8 @@ public override async Task Edit_two_properties_on_same_entity_updates_the_entire OUTPUT 1 WHERE [Id] = @p2; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] WHERE [j].[Id] = 1 @@ -1185,8 +1185,8 @@ public override async Task Edit_a_scalar_property_and_reference_navigation_on_th OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -1207,8 +1207,8 @@ public override async Task Edit_a_scalar_property_and_collection_navigation_on_t OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -1229,8 +1229,8 @@ public override async Task Edit_a_scalar_property_and_another_property_behind_re OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[EntityBasicId], [j].[Name], [j].[OwnedCollectionRoot], [j].[OwnedReferenceRoot] FROM [JsonEntitiesBasic] AS [j] """); @@ -1251,8 +1251,8 @@ public override async Task Edit_single_property_with_converter_bool_to_int_zero_ OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] WHERE [j].[Id] = 1 @@ -1274,8 +1274,8 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Tr OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] WHERE [j].[Id] = 1 @@ -1297,8 +1297,8 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Y_ OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] WHERE [j].[Id] = 1 @@ -1320,8 +1320,8 @@ public override async Task Edit_single_property_with_converter_int_zero_one_to_b OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] WHERE [j].[Id] = 1 @@ -1344,8 +1344,8 @@ public override async Task Edit_single_property_with_converter_string_True_False OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] WHERE [j].[Id] = 1 @@ -1368,8 +1368,8 @@ public override async Task Edit_single_property_with_converter_string_Y_N_to_boo OUTPUT 1 WHERE [Id] = @p1; """, - // - """ + // +""" SELECT TOP(2) [j].[Id], [j].[Reference] FROM [JsonEntitiesConverters] AS [j] WHERE [j].[Id] = 1 diff --git a/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs index c50255bd440..aa4e3397ae8 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs @@ -24,8 +24,8 @@ public override async Task Add_element_to_json_collection_branch() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -45,8 +45,8 @@ public override async Task Add_element_to_json_collection_leaf() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -66,8 +66,8 @@ public override async Task Add_element_to_json_collection_on_derived() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Discriminator", "j"."Name", "j"."Fraction", "j"."CollectionOnBase", "j"."ReferenceOnBase", "j"."CollectionOnDerived", "j"."ReferenceOnDerived" FROM "JsonEntitiesInheritance" AS "j" WHERE "j"."Discriminator" = 'JsonEntityInheritanceDerived' @@ -88,8 +88,8 @@ public override async Task Add_element_to_json_collection_root() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -110,8 +110,8 @@ public override async Task Add_entity_with_json() INSERT INTO "JsonEntitiesBasic" ("OwnedReferenceRoot", "Id", "EntityBasicId", "Name") VALUES (@p0, @p1, @p2, @p3); """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" """); @@ -130,8 +130,8 @@ public override async Task Add_json_reference_leaf() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -151,8 +151,8 @@ public override async Task Add_json_reference_root() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -171,8 +171,8 @@ DELETE FROM "JsonEntitiesBasic" WHERE "Id" = @p0 RETURNING 1; """, - // - """ + // +""" SELECT COUNT(*) FROM "JsonEntitiesBasic" AS "j" """); @@ -191,8 +191,8 @@ public override async Task Delete_json_collection_branch() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -212,8 +212,8 @@ public override async Task Delete_json_collection_root() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -233,8 +233,8 @@ public override async Task Delete_json_reference_leaf() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -254,8 +254,8 @@ public override async Task Delete_json_reference_root() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -275,8 +275,8 @@ public override async Task Edit_element_in_json_collection_branch() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -296,8 +296,8 @@ public override async Task Edit_element_in_json_collection_root1() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -317,8 +317,8 @@ public override async Task Edit_element_in_json_collection_root2() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -339,8 +339,8 @@ public override async Task Edit_element_in_json_multiple_levels_partial_update() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -360,8 +360,8 @@ public override async Task Edit_element_in_json_branch_collection_and_add_elemen WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -381,8 +381,8 @@ public override async Task Edit_two_elements_in_the_same_json_collection() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -402,8 +402,8 @@ public override async Task Edit_two_elements_in_the_same_json_collection_at_the_ WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -423,8 +423,8 @@ public override async Task Edit_collection_element_and_reference_at_once() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -445,8 +445,8 @@ public override async Task Edit_single_enum_property() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -467,8 +467,8 @@ public override async Task Edit_single_numeric_property() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -489,8 +489,8 @@ public override async Task Edit_single_property_bool() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -512,8 +512,8 @@ public override async Task Edit_single_property_byte() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -534,8 +534,8 @@ public override async Task Edit_single_property_char() WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -557,8 +557,8 @@ public override async Task Edit_single_property_datetime() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -580,8 +580,8 @@ public override async Task Edit_single_property_datetimeoffset() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -603,8 +603,8 @@ public override async Task Edit_single_property_decimal() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -626,8 +626,8 @@ public override async Task Edit_single_property_double() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -649,8 +649,8 @@ public override async Task Edit_single_property_guid() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -672,8 +672,8 @@ public override async Task Edit_single_property_int16() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -695,8 +695,8 @@ public override async Task Edit_single_property_int32() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -718,8 +718,8 @@ public override async Task Edit_single_property_int64() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -741,8 +741,8 @@ public override async Task Edit_single_property_signed_byte() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -764,8 +764,8 @@ public override async Task Edit_single_property_single() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -787,8 +787,8 @@ public override async Task Edit_single_property_timespan() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -810,8 +810,8 @@ public override async Task Edit_single_property_uint16() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -833,8 +833,8 @@ public override async Task Edit_single_property_uint32() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -856,8 +856,8 @@ public override async Task Edit_single_property_uint64() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -879,8 +879,8 @@ public override async Task Edit_single_property_nullable_int32() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -902,8 +902,8 @@ public override async Task Edit_single_property_nullable_int32_set_to_null() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -925,8 +925,8 @@ public override async Task Edit_single_property_enum() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -940,16 +940,16 @@ public override async Task Edit_single_property_enum_with_int_converter() AssertSql( """ -@p0='Three' (Nullable = false) (Size = 5) -@p1='Three' (Nullable = false) (Size = 5) +@p0='2' (DbType = String) +@p1='2' (DbType = String) @p2='1' UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnumWithIntConverter', @p0), "Reference" = json_set("Reference", '$.TestEnumWithIntConverter', @p1) WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -971,8 +971,8 @@ public override async Task Edit_single_property_nullable_enum() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -994,8 +994,8 @@ public override async Task Edit_single_property_nullable_enum_set_to_null() WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -1009,16 +1009,16 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter AssertSql( """ -@p0='One' (Nullable = false) (Size = 3) -@p1='Three' (Nullable = false) (Size = 5) +@p0='0' (DbType = String) +@p1='2' (DbType = String) @p2='1' UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithIntConverter', @p0), "Reference" = json_set("Reference", '$.TestNullableEnumWithIntConverter', @p1) WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -1040,8 +1040,8 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -1063,8 +1063,8 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -1078,16 +1078,16 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha AssertSql( """ -@p0=NULL (Nullable = false) -@p1=NULL (Nullable = false) +@p0='Null' (Nullable = false) (Size = 4) +@p1='Null' (Nullable = false) (Size = 4) @p2='1' UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithConverterThatHandlesNulls', @p0), "Reference" = json_set("Reference", '$.TestNullableEnumWithConverterThatHandlesNulls', @p1) WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -1101,16 +1101,16 @@ public override async Task Edit_two_properties_on_same_entity_updates_the_entire 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,"TestDefaultString":"MyDefaultStringInCollection1","TestDouble":-1.2345,"TestEnum":"One","TestEnumWithIntConverter":"Two","TestGuid":"00000000-0000-0000-0000-000000000000","TestInt16":-12,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Baz","TestNullableEnum":"One","TestNullableEnumWithConverterThatHandlesNulls":"Two","TestNullableEnumWithIntConverter":"Three","TestNullableInt32":90,"TestSignedByte":-18,"TestSingle":-1.4,"TestTimeSpan":"06:05:04.0030000","TestUnsignedInt16":12,"TestUnsignedInt32":12345,"TestUnsignedInt64":1234567867}' (Nullable = false) (Size = 710) -@p1='{"TestBoolean":true,"TestByte":255,"TestCharacter":"a","TestDateTime":"2000-01-01T12:34:56","TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDecimal":-1234567890.01,"TestDefaultString":"MyDefaultStringInReference1","TestDouble":-1.23456789,"TestEnum":"One","TestEnumWithIntConverter":"Two","TestGuid":"12345678-1234-4321-7777-987654321000","TestInt16":-1234,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Foo","TestNullableEnum":"One","TestNullableEnumWithConverterThatHandlesNulls":"Three","TestNullableEnumWithIntConverter":"Two","TestNullableInt32":78,"TestSignedByte":-128,"TestSingle":-1.234,"TestTimeSpan":"10:09:08.0070000","TestUnsignedInt16":1234,"TestUnsignedInt32":1234565789,"TestUnsignedInt64":1234567890123456789}' (Nullable = false) (Size = 738) +@p0='{"TestBoolean":false,"TestByte":25,"TestCharacter":"h","TestDateTime":"2100-11-11T12:34:56","TestDateTimeOffset":"2200-11-11T12:34:56-05:00","TestDecimal":-123450.01,"TestDefaultString":"MyDefaultStringInCollection1","TestDouble":-1.2345,"TestEnum":"One","TestEnumWithIntConverter":1,"TestGuid":"00000000-0000-0000-0000-000000000000","TestInt16":-12,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Baz","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 = 700) +@p1='{"TestBoolean":true,"TestByte":255,"TestCharacter":"a","TestDateTime":"2000-01-01T12:34:56","TestDateTimeOffset":"2000-01-01T12:34:56-08:00","TestDecimal":-1234567890.01,"TestDefaultString":"MyDefaultStringInReference1","TestDouble":-1.23456789,"TestEnum":"One","TestEnumWithIntConverter":1,"TestGuid":"12345678-1234-4321-7777-987654321000","TestInt16":-1234,"TestInt32":32,"TestInt64":64,"TestMaxLengthString":"Foo","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 = 730) @p2='1' UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0]', json(@p0)), "Reference" = @p1 WHERE "Id" = @p2 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Collection", "j"."Reference" FROM "JsonEntitiesAllTypes" AS "j" WHERE "j"."Id" = 1 @@ -1131,8 +1131,8 @@ public override async Task Edit_a_scalar_property_and_reference_navigation_on_th WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -1152,8 +1152,8 @@ public override async Task Edit_a_scalar_property_and_collection_navigation_on_t WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -1173,8 +1173,8 @@ public override async Task Edit_a_scalar_property_and_another_property_behind_re WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."EntityBasicId", "j"."Name", "j"."OwnedCollectionRoot", "j"."OwnedReferenceRoot" FROM "JsonEntitiesBasic" AS "j" LIMIT 2 @@ -1194,8 +1194,8 @@ public override async Task Edit_single_property_with_converter_bool_to_int_zero_ WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Reference" FROM "JsonEntitiesConverters" AS "j" WHERE "j"."Id" = 1 @@ -1216,8 +1216,8 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Tr WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Reference" FROM "JsonEntitiesConverters" AS "j" WHERE "j"."Id" = 1 @@ -1238,8 +1238,8 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Y_ WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Reference" FROM "JsonEntitiesConverters" AS "j" WHERE "j"."Id" = 1 @@ -1260,8 +1260,8 @@ public override async Task Edit_single_property_with_converter_int_zero_one_to_b WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Reference" FROM "JsonEntitiesConverters" AS "j" WHERE "j"."Id" = 1 @@ -1282,8 +1282,8 @@ public override async Task Edit_single_property_with_converter_string_True_False WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Reference" FROM "JsonEntitiesConverters" AS "j" WHERE "j"."Id" = 1 @@ -1304,8 +1304,8 @@ public override async Task Edit_single_property_with_converter_string_Y_N_to_boo WHERE "Id" = @p1 RETURNING 1; """, - // - """ + // +""" SELECT "j"."Id", "j"."Reference" FROM "JsonEntitiesConverters" AS "j" WHERE "j"."Id" = 1