From 26e7e6f8ecf68f424deabcc5f901519da18f45d7 Mon Sep 17 00:00:00 2001 From: Maurycy Markowski Date: Mon, 6 Mar 2023 17:48:45 -0800 Subject: [PATCH] Fix to #30410 - JSON: optimize update path for single property element - don't wrap the value in json array Rather than generate a JSON parameter and extract correct value from it, we generate the parameter value directly. Special casing is handled on the provider level by *ModificationCommand and *UpdateSqlGenerator Fixes #30410 --- .../Update/ModificationCommand.cs | 22 +- .../SqlServerServiceCollectionExtensions.cs | 1 + .../Internal/SqlServerModificationCommand.cs | 62 ++++++ .../SqlServerModificationCommandFactory.cs | 33 +++ .../Internal/SqlServerUpdateSqlGenerator.cs | 2 - .../Internal/SqliteModificationCommand.cs | 17 +- .../Internal/SqliteUpdateSqlGenerator.cs | 15 +- .../Update/JsonUpdateSqlServerTest.cs | 208 +++++++++--------- .../Update/JsonUpdateSqliteTest.cs | 208 +++++++++--------- 9 files changed, 334 insertions(+), 234 deletions(-) create mode 100644 src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommand.cs create mode 100644 src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommandFactory.cs diff --git a/src/EFCore.Relational/Update/ModificationCommand.cs b/src/EFCore.Relational/Update/ModificationCommand.cs index 70c4c3d5a0c..b71d0dbb111 100644 --- a/src/EFCore.Relational/Update/ModificationCommand.cs +++ b/src/EFCore.Relational/Update/ModificationCommand.cs @@ -327,9 +327,10 @@ private List GenerateColumnModifications() var jsonPathString = string.Join( ".", updateInfo.Path.Select(x => x.PropertyName + (x.Ordinal != null ? "[" + x.Ordinal + "]" : ""))); + object? singlePropertyValue = default; if (updateInfo.Property != null) { - json = new JsonArray(GenerateJsonForSinglePropertyUpdate(updateInfo.Property, updateInfo.PropertyValue)); + singlePropertyValue = GenerateValueForSinglePropertyUpdate(updateInfo.Property, updateInfo.PropertyValue); jsonPathString = jsonPathString + "." + updateInfo.Property.GetJsonPropertyName(); } else @@ -367,7 +368,7 @@ private List GenerateColumnModifications() var columnModificationParameters = new ColumnModificationParameters( jsonColumn.Name, - value: json?.ToJsonString(), + value: updateInfo.Property != null ? singlePropertyValue : json?.ToJsonString(), property: updateInfo.Property, columnType: jsonColumnTypeMapping.StoreType, jsonColumnTypeMapping, @@ -699,14 +700,23 @@ static JsonPartialUpdateInfo FindCommonJsonPartialUpdateInfo( } /// - /// Generates representing the value to use for update in case a single property is being updated. + /// Generates value to use for update in case a single property is being updated. /// /// Property to be updated. /// Value object that the property will be updated to. - /// representing the value that the property will be updated to. + /// Value that the property will be updated to. [EntityFrameworkInternal] - protected virtual JsonNode? GenerateJsonForSinglePropertyUpdate(IProperty property, object? propertyValue) - => JsonValue.Create(propertyValue); + protected virtual object? GenerateValueForSinglePropertyUpdate(IProperty property, object? propertyValue) + { + var propertyProviderClrType = (property.GetTypeMapping().Converter?.ProviderClrType ?? property.ClrType).UnwrapNullableType(); + + return (propertyProviderClrType == typeof(DateTime) + || propertyProviderClrType == typeof(DateTimeOffset) + || propertyProviderClrType == typeof(TimeSpan) + || propertyProviderClrType == typeof(Guid)) + ? JsonValue.Create(propertyValue)?.ToJsonString().Replace("\"", "") + : propertyValue; + } private JsonNode? CreateJson(object? navigationValue, IUpdateEntry parentEntry, IEntityType entityType, int? ordinal, bool isCollection) { diff --git a/src/EFCore.SqlServer/Extensions/SqlServerServiceCollectionExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerServiceCollectionExtensions.cs index 63f8284b289..08fd2368865 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerServiceCollectionExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerServiceCollectionExtensions.cs @@ -106,6 +106,7 @@ public static IServiceCollection AddEntityFrameworkSqlServer(this IServiceCollec .TryAdd() .TryAdd() .TryAdd() + .TryAdd() .TryAdd() .TryAdd(p => p.GetRequiredService()) .TryAdd() diff --git a/src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommand.cs b/src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommand.cs new file mode 100644 index 00000000000..ffd60b3b960 --- /dev/null +++ b/src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommand.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Text.Json.Nodes; + +namespace Microsoft.EntityFrameworkCore.SqlServer.Update.Internal; + +/// +/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to +/// the same compatibility standards as public APIs. It may be changed or removed without notice in +/// any release. You should only use it directly in your code with extreme caution and knowing that +/// doing so can result in application failures when updating to a new Entity Framework Core release. +/// +public class SqlServerModificationCommand : ModificationCommand +{ + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public SqlServerModificationCommand(in ModificationCommandParameters modificationCommandParameters) + : base(modificationCommandParameters) + { + } + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public SqlServerModificationCommand(in NonTrackedModificationCommandParameters modificationCommandParameters) + : base(modificationCommandParameters) + { + } + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + protected override object? GenerateValueForSinglePropertyUpdate(IProperty property, object? propertyValue) + { + var propertyProviderClrType = (property.GetTypeMapping().Converter?.ProviderClrType ?? property.ClrType).UnwrapNullableType(); + + // HACK/WORKAROUND: when we generate SqlParameter for byte value, we use JSON type mapping + // (we don't have dedicated type mapping for individual JSON properties) + // this (for some reason) generates a varchar parameter of incorrect size, e.g. byte value = 15 generates nvarchar(1) + // and the JSON property gets updated with value '1' + // to mitigate this, we convert the value to string, to guarantee the correct parameter size. + if (propertyProviderClrType == typeof(byte)) + { + return JsonValue.Create(propertyValue)?.ToJsonString().Replace("\"", ""); + } + +#pragma warning disable EF1001 // Internal EF Core API usage. + return base.GenerateValueForSinglePropertyUpdate(property, propertyValue); +#pragma warning restore EF1001 // Internal EF Core API usage. + } +} diff --git a/src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommandFactory.cs b/src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommandFactory.cs new file mode 100644 index 00000000000..1c68982b747 --- /dev/null +++ b/src/EFCore.SqlServer/Update/Internal/SqlServerModificationCommandFactory.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.EntityFrameworkCore.SqlServer.Update.Internal; + +/// +/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to +/// the same compatibility standards as public APIs. It may be changed or removed without notice in +/// any release. You should only use it directly in your code with extreme caution and knowing that +/// doing so can result in application failures when updating to a new Entity Framework Core release. +/// +public class SqlServerModificationCommandFactory : IModificationCommandFactory +{ + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public virtual IModificationCommand CreateModificationCommand( + in ModificationCommandParameters modificationCommandParameters) + => new SqlServerModificationCommand(modificationCommandParameters); + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public virtual INonTrackedModificationCommand CreateNonTrackedModificationCommand( + in NonTrackedModificationCommandParameters modificationCommandParameters) + => new SqlServerModificationCommand(modificationCommandParameters); +} diff --git a/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs b/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs index c7ff1293273..2d14fa51cf6 100644 --- a/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs +++ b/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs @@ -164,9 +164,7 @@ protected override void AppendUpdateColumnValue( stringBuilder.Append("CAST("); } - stringBuilder.Append("JSON_VALUE("); base.AppendUpdateColumnValue(updateSqlGeneratorHelper, columnModification, stringBuilder, name, schema); - stringBuilder.Append(", '$[0]')"); if (needsTypeConversion) { diff --git a/src/EFCore.Sqlite.Core/Update/Internal/SqliteModificationCommand.cs b/src/EFCore.Sqlite.Core/Update/Internal/SqliteModificationCommand.cs index 2967931a8c4..c8dab18b2c2 100644 --- a/src/EFCore.Sqlite.Core/Update/Internal/SqliteModificationCommand.cs +++ b/src/EFCore.Sqlite.Core/Update/Internal/SqliteModificationCommand.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Text.Json.Nodes; - namespace Microsoft.EntityFrameworkCore.Sqlite.Update.Internal; /// @@ -41,25 +39,22 @@ public SqliteModificationCommand(in NonTrackedModificationCommandParameters modi /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - protected override JsonNode? GenerateJsonForSinglePropertyUpdate(IProperty property, object? propertyValue) + protected override object? GenerateValueForSinglePropertyUpdate(IProperty property, object? propertyValue) { - if (propertyValue is bool boolPropertyValue - && (property.GetTypeMapping().Converter?.ProviderClrType ?? property.ClrType).UnwrapNullableType() == typeof(bool)) + var propertyProviderClrType = (property.GetTypeMapping().Converter?.ProviderClrType ?? property.ClrType).UnwrapNullableType(); + + if (propertyProviderClrType == typeof(bool) && propertyValue is bool boolPropertyValue) { // Sqlite converts true/false into native 0/1 when using json_extract // so we convert those values to strings so that they stay as true/false // which is what we want to store in json object in the end - var modifiedPropertyValue = boolPropertyValue + return boolPropertyValue ? "true" : "false"; - -#pragma warning disable EF1001 // Internal EF Core API usage. - return base.GenerateJsonForSinglePropertyUpdate(property, modifiedPropertyValue); -#pragma warning restore EF1001 // Internal EF Core API usage. } #pragma warning disable EF1001 // Internal EF Core API usage. - return base.GenerateJsonForSinglePropertyUpdate(property, propertyValue); + return base.GenerateValueForSinglePropertyUpdate(property, propertyValue); #pragma warning restore EF1001 // Internal EF Core API usage. } } diff --git a/src/EFCore.Sqlite.Core/Update/Internal/SqliteUpdateSqlGenerator.cs b/src/EFCore.Sqlite.Core/Update/Internal/SqliteUpdateSqlGenerator.cs index 68e5be1a8a7..5a4014630b4 100644 --- a/src/EFCore.Sqlite.Core/Update/Internal/SqliteUpdateSqlGenerator.cs +++ b/src/EFCore.Sqlite.Core/Update/Internal/SqliteUpdateSqlGenerator.cs @@ -162,24 +162,25 @@ protected override void AppendUpdateColumnValue( if (columnModification.Property != null) { + var providerClrType = (columnModification.Property.GetTypeMapping().Converter?.ProviderClrType + ?? columnModification.Property.ClrType).UnwrapNullableType(); + // special handling for bool // json_extract converts true/false into native 0/1 values, // but we want to store the values as true/false in JSON // in order to do that we modify the parameter value to "true"/"false" // and wrap json() function around it to avoid conversion to 0/1 - var boolProviderType = (columnModification.Property.GetTypeMapping().Converter?.ProviderClrType - ?? columnModification.Property.ClrType).UnwrapNullableType() == typeof(bool); - - if (boolProviderType) + // + // for decimal, sqlite generates string parameter for decimal values + // but don't want to store the values as strings, we use json to "unwrap" it + if (providerClrType == typeof(bool) || providerClrType == typeof(decimal)) { stringBuilder.Append("json("); } - stringBuilder.Append("json_extract("); base.AppendUpdateColumnValue(updateSqlGeneratorHelper, columnModification, stringBuilder, name, schema); - stringBuilder.Append(", '$[0]')"); - if (boolProviderType) + if (providerClrType == typeof(bool) || providerClrType == typeof(decimal)) { stringBuilder.Append(")"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs index 3866acc319f..8ee8874e2ec 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateSqlServerTest.cs @@ -282,12 +282,12 @@ public override async Task Edit_element_in_json_collection_branch() AssertSql( """ -@p0='["2111-11-11T00:00:00"]' (Nullable = false) (Size = 23) +@p0='2111-11-11T00:00:00' (Nullable = false) (Size = 19) @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]')) +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[0].OwnedCollectionBranch[0].Date', @p0) OUTPUT 1 WHERE [Id] = @p1; """, @@ -304,12 +304,12 @@ public override async Task Edit_element_in_json_collection_root1() AssertSql( """ -@p0='["Modified"]' (Nullable = false) (Size = 12) +@p0='Modified' (Nullable = false) (Size = 8) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[0].Name', JSON_VALUE(@p0, '$[0]')) +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[0].Name', @p0) OUTPUT 1 WHERE [Id] = @p1; """, @@ -326,12 +326,12 @@ public override async Task Edit_element_in_json_collection_root2() AssertSql( """ -@p0='["Modified"]' (Nullable = false) (Size = 12) +@p0='Modified' (Nullable = false) (Size = 8) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Name', JSON_VALUE(@p0, '$[0]')) +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Name', @p0) OUTPUT 1 WHERE [Id] = @p1; """, @@ -459,13 +459,13 @@ public override async Task Edit_single_enum_property() AssertSql( """ -@p0='["Two"]' (Nullable = false) (Size = 7) -@p1='["Two"]' (Nullable = false) (Size = 7) +@p0='Two' (Nullable = false) (Size = 3) +@p1='Two' (Nullable = false) (Size = 3) @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]')) +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].OwnedCollectionBranch[1].Enum', @p0), [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.OwnedReferenceBranch.Enum', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -482,13 +482,13 @@ public override async Task Edit_single_numeric_property() AssertSql( """ -@p0='[1024]' (Nullable = false) (Size = 6) -@p1='[999]' (Nullable = false) (Size = 5) +@p0='1024' (DbType = String) +@p1='999' (DbType = String) @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)) +UPDATE [JsonEntitiesBasic] SET [OwnedCollectionRoot] = JSON_MODIFY([OwnedCollectionRoot], 'strict $[1].Number', CAST(@p0 AS int)), [OwnedReferenceRoot] = JSON_MODIFY([OwnedReferenceRoot], 'strict $.Number', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -505,13 +505,13 @@ public override async Task Edit_single_property_bool() AssertSql( """ -@p0='[true]' (Nullable = false) (Size = 6) -@p1='[false]' (Nullable = false) (Size = 7) +@p0='True' (DbType = String) +@p1='False' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestBoolean', CAST(@p0 AS bit)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestBoolean', CAST(@p1 AS bit)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -529,13 +529,13 @@ public override async Task Edit_single_property_byte() AssertSql( """ -@p0='[14]' (Nullable = false) (Size = 4) -@p1='[25]' (Nullable = false) (Size = 4) +@p0='14' (Nullable = false) (Size = 2) +@p1='25' (Nullable = false) (Size = 2) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestByte', CAST(@p0 AS tinyint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestByte', CAST(@p1 AS tinyint)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -553,12 +553,12 @@ public override async Task Edit_single_property_char() AssertSql( """ -@p0='["t"]' (Nullable = false) (Size = 5) +@p0='t' (Nullable = false) (Size = 1) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Reference] = JSON_MODIFY([Reference], 'strict $.TestCharacter', JSON_VALUE(@p0, '$[0]')) +UPDATE [JsonEntitiesAllTypes] SET [Reference] = JSON_MODIFY([Reference], 'strict $.TestCharacter', @p0) OUTPUT 1 WHERE [Id] = @p1; """, @@ -576,13 +576,13 @@ public override async Task 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) +@p0='3000-01-01T12:34:56' (Nullable = false) (Size = 19) +@p1='3000-01-01T12:34:56' (Nullable = false) (Size = 19) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateTime', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateTime', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -600,13 +600,13 @@ public override async Task 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) +@p0='3000-01-01T12:34:56-04:00' (Nullable = false) (Size = 25) +@p1='3000-01-01T12:34:56-04:00' (Nullable = false) (Size = 25) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDateTimeOffset', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDateTimeOffset', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -624,13 +624,13 @@ public override async Task Edit_single_property_decimal() AssertSql( """ -@p0='[-13579.01]' (Nullable = false) (Size = 11) -@p1='[-13579.01]' (Nullable = false) (Size = 11) +@p0='-13579.01' (DbType = String) +@p1='-13579.01' (DbType = String) @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))) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDecimal', CAST(@p0 AS decimal(18,3))), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDecimal', CAST(@p1 AS decimal(18,3))) OUTPUT 1 WHERE [Id] = @p2; """, @@ -648,13 +648,13 @@ public override async Task Edit_single_property_double() AssertSql( """ -@p0='[-1.23579]' (Nullable = false) (Size = 10) -@p1='[-1.23579]' (Nullable = false) (Size = 10) +@p0='-1.23579' (DbType = String) +@p1='-1.23579' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestDouble', CAST(@p0 AS float)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestDouble', CAST(@p1 AS float)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -672,13 +672,13 @@ public override async Task 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) +@p0='12345678-1234-4321-5555-987654321000' (Nullable = false) (Size = 36) +@p1='12345678-1234-4321-5555-987654321000' (Nullable = false) (Size = 36) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestGuid', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestGuid', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -696,13 +696,13 @@ public override async Task Edit_single_property_int16() AssertSql( """ -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) +@p0='-3234' (DbType = String) +@p1='-3234' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt16', CAST(@p0 AS smallint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt16', CAST(@p1 AS smallint)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -720,13 +720,13 @@ public override async Task Edit_single_property_int32() AssertSql( """ -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) +@p0='-3234' (DbType = String) +@p1='-3234' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt32', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt32', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -744,13 +744,13 @@ public override async Task Edit_single_property_int64() AssertSql( """ -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) +@p0='-3234' (DbType = String) +@p1='-3234' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestInt64', CAST(@p0 AS bigint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestInt64', CAST(@p1 AS bigint)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -768,13 +768,13 @@ public override async Task Edit_single_property_signed_byte() AssertSql( """ -@p0='[-108]' (Nullable = false) (Size = 6) -@p1='[-108]' (Nullable = false) (Size = 6) +@p0='-108' (DbType = String) +@p1='-108' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestSignedByte', CAST(@p0 AS smallint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestSignedByte', CAST(@p1 AS smallint)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -792,13 +792,13 @@ public override async Task Edit_single_property_single() AssertSql( """ -@p0='[-7.234]' (Nullable = false) (Size = 8) -@p1='[-7.234]' (Nullable = false) (Size = 8) +@p0='-7.234' (DbType = String) +@p1='-7.234' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestSingle', CAST(@p0 AS real)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestSingle', CAST(@p1 AS real)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -816,13 +816,13 @@ public override async Task Edit_single_property_timespan() AssertSql( """ -@p0='["10:01:01.0070000"]' (Nullable = false) (Size = 20) -@p1='["10:01:01.0070000"]' (Nullable = false) (Size = 20) +@p0='10:01:01.0070000' (Nullable = false) (Size = 16) +@p1='10:01:01.0070000' (Nullable = false) (Size = 16) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestTimeSpan', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestTimeSpan', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -840,13 +840,13 @@ public override async Task Edit_single_property_uint16() AssertSql( """ -@p0='[1534]' (Nullable = false) (Size = 6) -@p1='[1534]' (Nullable = false) (Size = 6) +@p0='1534' (DbType = String) +@p1='1534' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt16', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt16', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -864,13 +864,13 @@ public override async Task Edit_single_property_uint32() AssertSql( """ -@p0='[1237775789]' (Nullable = false) (Size = 12) -@p1='[1237775789]' (Nullable = false) (Size = 12) +@p0='1237775789' (DbType = String) +@p1='1237775789' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt32', CAST(@p0 AS bigint)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt32', CAST(@p1 AS bigint)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -888,13 +888,13 @@ public override async Task Edit_single_property_uint64() AssertSql( """ -@p0='[1234555555123456789]' (Nullable = false) (Size = 21) -@p1='[1234555555123456789]' (Nullable = false) (Size = 21) +@p0='1234555555123456789' (DbType = String) +@p1='1234555555123456789' (DbType = String) @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))) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestUnsignedInt64', CAST(@p0 AS decimal(20,0))), [Reference] = JSON_MODIFY([Reference], 'strict $.TestUnsignedInt64', CAST(@p1 AS decimal(20,0))) OUTPUT 1 WHERE [Id] = @p2; """, @@ -912,13 +912,13 @@ public override async Task Edit_single_property_nullable_int32() AssertSql( """ -@p0='[122354]' (Nullable = false) (Size = 8) -@p1='[64528]' (Nullable = false) (Size = 7) +@p0='122354' (DbType = String) +@p1='64528' (DbType = String) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableInt32', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableInt32', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -936,13 +936,13 @@ public override async Task Edit_single_property_nullable_int32_set_to_null() AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @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)) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableInt32', CAST(@p0 AS int)), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableInt32', CAST(@p1 AS int)) OUTPUT 1 WHERE [Id] = @p2; """, @@ -960,13 +960,13 @@ public override async Task Edit_single_property_enum() AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='Three' (Nullable = false) (Size = 5) +@p1='Three' (Nullable = false) (Size = 5) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnum', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnum', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -984,13 +984,13 @@ public override async Task Edit_single_property_enum_with_int_converter() AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='Three' (Nullable = false) (Size = 5) +@p1='Three' (Nullable = false) (Size = 5) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumWithIntConverter', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumWithIntConverter', JSON_VALUE(@p1, '$[0]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnumWithIntConverter', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnumWithIntConverter', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1008,13 +1008,13 @@ public override async Task Edit_single_property_nullable_enum() AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='Three' (Nullable = false) (Size = 5) +@p1='Three' (Nullable = false) (Size = 5) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestEnum', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestEnum', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1032,13 +1032,13 @@ public override async Task Edit_single_property_nullable_enum_set_to_null() AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnum', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnum', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1056,13 +1056,13 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter AssertSql( """ -@p0='["One"]' (Nullable = false) (Size = 7) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='One' (Nullable = false) (Size = 3) +@p1='Three' (Nullable = false) (Size = 5) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', JSON_VALUE(@p1, '$[0]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1080,13 +1080,13 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @p2='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', JSON_VALUE(@p0, '$[0]')), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', JSON_VALUE(@p1, '$[0]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithIntConverter', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithIntConverter', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1104,13 +1104,13 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["One"]' (Nullable = false) (Size = 7) +@p0='Three' (Nullable = false) (Size = 5) +@p1='One' (Nullable = false) (Size = 3) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithConverterThatHandlesNulls', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithConverterThatHandlesNulls', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1128,13 +1128,13 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @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]')) +UPDATE [JsonEntitiesAllTypes] SET [Collection] = JSON_MODIFY([Collection], 'strict $[0].TestNullableEnumWithConverterThatHandlesNulls', @p0), [Reference] = JSON_MODIFY([Reference], 'strict $.TestNullableEnumWithConverterThatHandlesNulls', @p1) OUTPUT 1 WHERE [Id] = @p2; """, @@ -1242,12 +1242,12 @@ public override async Task Edit_single_property_with_converter_bool_to_int_zero_ AssertSql( """ -@p0='[0]' (Nullable = false) (Size = 3) +@p0='0' (DbType = String) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.BoolConvertedToIntZeroOne', CAST(JSON_VALUE(@p0, '$[0]') AS int)) +UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.BoolConvertedToIntZeroOne', CAST(@p0 AS int)) OUTPUT 1 WHERE [Id] = @p1; """, @@ -1265,12 +1265,12 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Tr AssertSql( """ -@p0='["True"]' (Nullable = false) (Size = 8) +@p0='True' (Nullable = false) (Size = 4) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.BoolConvertedToStringTrueFalse', JSON_VALUE(@p0, '$[0]')) +UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.BoolConvertedToStringTrueFalse', @p0) OUTPUT 1 WHERE [Id] = @p1; """, @@ -1288,12 +1288,12 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Y_ AssertSql( """ -@p0='["N"]' (Nullable = false) (Size = 5) +@p0='N' (Nullable = false) (Size = 1) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.BoolConvertedToStringYN', JSON_VALUE(@p0, '$[0]')) +UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.BoolConvertedToStringYN', @p0) OUTPUT 1 WHERE [Id] = @p1; """, @@ -1311,12 +1311,12 @@ public override async Task Edit_single_property_with_converter_int_zero_one_to_b AssertSql( """ -@p0='[true]' (Nullable = false) (Size = 6) +@p0='True' (DbType = String) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.IntZeroOneConvertedToBool', CAST(JSON_VALUE(@p0, '$[0]') AS bit)) +UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.IntZeroOneConvertedToBool', CAST(@p0 AS bit)) OUTPUT 1 WHERE [Id] = @p1; """, @@ -1335,12 +1335,12 @@ public override async Task Edit_single_property_with_converter_string_True_False AssertSql( """ -@p0='[false]' (Nullable = false) (Size = 7) +@p0='False' (DbType = String) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.StringTrueFalseConvertedToBool', CAST(JSON_VALUE(@p0, '$[0]') AS bit)) +UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.StringTrueFalseConvertedToBool', CAST(@p0 AS bit)) OUTPUT 1 WHERE [Id] = @p1; """, @@ -1359,12 +1359,12 @@ public override async Task Edit_single_property_with_converter_string_Y_N_to_boo AssertSql( """ -@p0='[true]' (Nullable = false) (Size = 6) +@p0='True' (DbType = String) @p1='1' SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; -UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.StringYNConvertedToBool', CAST(JSON_VALUE(@p0, '$[0]') AS bit)) +UPDATE [JsonEntitiesConverters] SET [Reference] = JSON_MODIFY([Reference], 'strict $.StringYNConvertedToBool', CAST(@p0 AS bit)) OUTPUT 1 WHERE [Id] = @p1; """, diff --git a/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs index 48046f19ec6..c50255bd440 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs @@ -268,10 +268,10 @@ public override async Task Edit_element_in_json_collection_branch() AssertSql( """ -@p0='["2111-11-11T00:00:00"]' (Nullable = false) (Size = 23) +@p0='2111-11-11T00:00:00' (Nullable = false) (Size = 19) @p1='1' -UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[0].OwnedCollectionBranch[0].Date', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[0].OwnedCollectionBranch[0].Date', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -289,10 +289,10 @@ public override async Task Edit_element_in_json_collection_root1() AssertSql( """ -@p0='["Modified"]' (Nullable = false) (Size = 12) +@p0='Modified' (Nullable = false) (Size = 8) @p1='1' -UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[0].Name', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[0].Name', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -310,10 +310,10 @@ public override async Task Edit_element_in_json_collection_root2() AssertSql( """ -@p0='["Modified"]' (Nullable = false) (Size = 12) +@p0='Modified' (Nullable = false) (Size = 8) @p1='1' -UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[1].Name', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[1].Name', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -437,11 +437,11 @@ public override async Task Edit_single_enum_property() AssertSql( """ -@p0='["Two"]' (Nullable = false) (Size = 7) -@p1='["Two"]' (Nullable = false) (Size = 7) +@p0='Two' (Nullable = false) (Size = 3) +@p1='Two' (Nullable = false) (Size = 3) @p2='1' -UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[1].OwnedCollectionBranch[1].Enum', json_extract(@p0, '$[0]')), "OwnedReferenceRoot" = json_set("OwnedReferenceRoot", '$.OwnedReferenceBranch.Enum', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[1].OwnedCollectionBranch[1].Enum', @p0), "OwnedReferenceRoot" = json_set("OwnedReferenceRoot", '$.OwnedReferenceBranch.Enum', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -459,11 +459,11 @@ public override async Task Edit_single_numeric_property() AssertSql( """ -@p0='[1024]' (Nullable = false) (Size = 6) -@p1='[999]' (Nullable = false) (Size = 5) +@p0='1024' (DbType = String) +@p1='999' (DbType = String) @p2='1' -UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[1].Number', json_extract(@p0, '$[0]')), "OwnedReferenceRoot" = json_set("OwnedReferenceRoot", '$.Number', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesBasic" SET "OwnedCollectionRoot" = json_set("OwnedCollectionRoot", '$[1].Number', @p0), "OwnedReferenceRoot" = json_set("OwnedReferenceRoot", '$.Number', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -481,11 +481,11 @@ public override async Task Edit_single_property_bool() AssertSql( """ -@p0='["true"]' (Nullable = false) (Size = 8) -@p1='["false"]' (Nullable = false) (Size = 9) +@p0='true' (Nullable = false) (Size = 4) +@p1='false' (Nullable = false) (Size = 5) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestBoolean', json(json_extract(@p0, '$[0]'))), "Reference" = json_set("Reference", '$.TestBoolean', json(json_extract(@p1, '$[0]'))) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestBoolean', json(@p0)), "Reference" = json_set("Reference", '$.TestBoolean', json(@p1)) WHERE "Id" = @p2 RETURNING 1; """, @@ -504,11 +504,11 @@ public override async Task Edit_single_property_byte() AssertSql( """ -@p0='[14]' (Nullable = false) (Size = 4) -@p1='[25]' (Nullable = false) (Size = 4) +@p0='14' (DbType = String) +@p1='25' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestByte', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestByte', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestByte', @p0), "Reference" = json_set("Reference", '$.TestByte', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -527,10 +527,10 @@ public override async Task Edit_single_property_char() AssertSql( """ -@p0='["t"]' (Nullable = false) (Size = 5) +@p0='t' (DbType = String) @p1='1' -UPDATE "JsonEntitiesAllTypes" SET "Reference" = json_set("Reference", '$.TestCharacter', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Reference" = json_set("Reference", '$.TestCharacter', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -549,11 +549,11 @@ public override async Task 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) +@p0='3000-01-01T12:34:56' (Nullable = false) (Size = 19) +@p1='3000-01-01T12:34:56' (Nullable = false) (Size = 19) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDateTime', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestDateTime', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDateTime', @p0), "Reference" = json_set("Reference", '$.TestDateTime', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -572,11 +572,11 @@ public override async Task 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) +@p0='3000-01-01T12:34:56-04:00' (Nullable = false) (Size = 25) +@p1='3000-01-01T12:34:56-04:00' (Nullable = false) (Size = 25) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDateTimeOffset', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestDateTimeOffset', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDateTimeOffset', @p0), "Reference" = json_set("Reference", '$.TestDateTimeOffset', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -595,11 +595,11 @@ public override async Task Edit_single_property_decimal() AssertSql( """ -@p0='[-13579.01]' (Nullable = false) (Size = 11) -@p1='[-13579.01]' (Nullable = false) (Size = 11) +@p0='-13579.01' (DbType = String) +@p1='-13579.01' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDecimal', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestDecimal', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDecimal', json(@p0)), "Reference" = json_set("Reference", '$.TestDecimal', json(@p1)) WHERE "Id" = @p2 RETURNING 1; """, @@ -618,11 +618,11 @@ public override async Task Edit_single_property_double() AssertSql( """ -@p0='[-1.23579]' (Nullable = false) (Size = 10) -@p1='[-1.23579]' (Nullable = false) (Size = 10) +@p0='-1.23579' (DbType = String) +@p1='-1.23579' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDouble', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestDouble', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestDouble', @p0), "Reference" = json_set("Reference", '$.TestDouble', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -641,11 +641,11 @@ public override async Task 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) +@p0='12345678-1234-4321-5555-987654321000' (Nullable = false) (Size = 36) +@p1='12345678-1234-4321-5555-987654321000' (Nullable = false) (Size = 36) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestGuid', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestGuid', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestGuid', @p0), "Reference" = json_set("Reference", '$.TestGuid', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -664,11 +664,11 @@ public override async Task Edit_single_property_int16() AssertSql( """ -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) +@p0='-3234' (DbType = String) +@p1='-3234' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestInt16', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestInt16', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestInt16', @p0), "Reference" = json_set("Reference", '$.TestInt16', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -687,11 +687,11 @@ public override async Task Edit_single_property_int32() AssertSql( """ -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) +@p0='-3234' (DbType = String) +@p1='-3234' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestInt32', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestInt32', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestInt32', @p0), "Reference" = json_set("Reference", '$.TestInt32', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -710,11 +710,11 @@ public override async Task Edit_single_property_int64() AssertSql( """ -@p0='[-3234]' (Nullable = false) (Size = 7) -@p1='[-3234]' (Nullable = false) (Size = 7) +@p0='-3234' (DbType = String) +@p1='-3234' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestInt64', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestInt64', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestInt64', @p0), "Reference" = json_set("Reference", '$.TestInt64', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -733,11 +733,11 @@ public override async Task Edit_single_property_signed_byte() AssertSql( """ -@p0='[-108]' (Nullable = false) (Size = 6) -@p1='[-108]' (Nullable = false) (Size = 6) +@p0='-108' (DbType = String) +@p1='-108' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestSignedByte', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestSignedByte', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestSignedByte', @p0), "Reference" = json_set("Reference", '$.TestSignedByte', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -756,11 +756,11 @@ public override async Task Edit_single_property_single() AssertSql( """ -@p0='[-7.234]' (Nullable = false) (Size = 8) -@p1='[-7.234]' (Nullable = false) (Size = 8) +@p0='-7.234' (DbType = String) +@p1='-7.234' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestSingle', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestSingle', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestSingle', @p0), "Reference" = json_set("Reference", '$.TestSingle', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -779,11 +779,11 @@ public override async Task Edit_single_property_timespan() AssertSql( """ -@p0='["10:01:01.0070000"]' (Nullable = false) (Size = 20) -@p1='["10:01:01.0070000"]' (Nullable = false) (Size = 20) +@p0='10:01:01.0070000' (Nullable = false) (Size = 16) +@p1='10:01:01.0070000' (Nullable = false) (Size = 16) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestTimeSpan', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestTimeSpan', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestTimeSpan', @p0), "Reference" = json_set("Reference", '$.TestTimeSpan', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -802,11 +802,11 @@ public override async Task Edit_single_property_uint16() AssertSql( """ -@p0='[1534]' (Nullable = false) (Size = 6) -@p1='[1534]' (Nullable = false) (Size = 6) +@p0='1534' (DbType = String) +@p1='1534' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestUnsignedInt16', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestUnsignedInt16', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestUnsignedInt16', @p0), "Reference" = json_set("Reference", '$.TestUnsignedInt16', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -825,11 +825,11 @@ public override async Task Edit_single_property_uint32() AssertSql( """ -@p0='[1237775789]' (Nullable = false) (Size = 12) -@p1='[1237775789]' (Nullable = false) (Size = 12) +@p0='1237775789' (DbType = String) +@p1='1237775789' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestUnsignedInt32', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestUnsignedInt32', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestUnsignedInt32', @p0), "Reference" = json_set("Reference", '$.TestUnsignedInt32', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -848,11 +848,11 @@ public override async Task Edit_single_property_uint64() AssertSql( """ -@p0='[1234555555123456789]' (Nullable = false) (Size = 21) -@p1='[1234555555123456789]' (Nullable = false) (Size = 21) +@p0='1234555555123456789' (DbType = String) +@p1='1234555555123456789' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestUnsignedInt64', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestUnsignedInt64', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestUnsignedInt64', @p0), "Reference" = json_set("Reference", '$.TestUnsignedInt64', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -871,11 +871,11 @@ public override async Task Edit_single_property_nullable_int32() AssertSql( """ -@p0='[122354]' (Nullable = false) (Size = 8) -@p1='[64528]' (Nullable = false) (Size = 7) +@p0='122354' (DbType = String) +@p1='64528' (DbType = String) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableInt32', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableInt32', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableInt32', @p0), "Reference" = json_set("Reference", '$.TestNullableInt32', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -894,11 +894,11 @@ public override async Task Edit_single_property_nullable_int32_set_to_null() AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableInt32', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableInt32', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableInt32', @p0), "Reference" = json_set("Reference", '$.TestNullableInt32', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -917,11 +917,11 @@ public override async Task Edit_single_property_enum() AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='Three' (Nullable = false) (Size = 5) +@p1='Three' (Nullable = false) (Size = 5) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnum', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestEnum', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnum', @p0), "Reference" = json_set("Reference", '$.TestEnum', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -940,11 +940,11 @@ public override async Task Edit_single_property_enum_with_int_converter() AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='Three' (Nullable = false) (Size = 5) +@p1='Three' (Nullable = false) (Size = 5) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnumWithIntConverter', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestEnumWithIntConverter', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnumWithIntConverter', @p0), "Reference" = json_set("Reference", '$.TestEnumWithIntConverter', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -963,11 +963,11 @@ public override async Task Edit_single_property_nullable_enum() AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='Three' (Nullable = false) (Size = 5) +@p1='Three' (Nullable = false) (Size = 5) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnum', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestEnum', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestEnum', @p0), "Reference" = json_set("Reference", '$.TestEnum', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -986,11 +986,11 @@ public override async Task Edit_single_property_nullable_enum_set_to_null() AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnum', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableEnum', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnum', @p0), "Reference" = json_set("Reference", '$.TestNullableEnum', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -1009,11 +1009,11 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter AssertSql( """ -@p0='["One"]' (Nullable = false) (Size = 7) -@p1='["Three"]' (Nullable = false) (Size = 9) +@p0='One' (Nullable = false) (Size = 3) +@p1='Three' (Nullable = false) (Size = 5) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithIntConverter', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableEnumWithIntConverter', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithIntConverter', @p0), "Reference" = json_set("Reference", '$.TestNullableEnumWithIntConverter', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -1032,11 +1032,11 @@ public override async Task Edit_single_property_nullable_enum_with_int_converter AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithIntConverter', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableEnumWithIntConverter', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithIntConverter', @p0), "Reference" = json_set("Reference", '$.TestNullableEnumWithIntConverter', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -1055,11 +1055,11 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha AssertSql( """ -@p0='["Three"]' (Nullable = false) (Size = 9) -@p1='["One"]' (Nullable = false) (Size = 7) +@p0='Three' (Nullable = false) (Size = 5) +@p1='One' (Nullable = false) (Size = 3) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithConverterThatHandlesNulls', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableEnumWithConverterThatHandlesNulls', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithConverterThatHandlesNulls', @p0), "Reference" = json_set("Reference", '$.TestNullableEnumWithConverterThatHandlesNulls', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -1078,11 +1078,11 @@ public override async Task Edit_single_property_nullable_enum_with_converter_tha AssertSql( """ -@p0='[null]' (Nullable = false) (Size = 6) -@p1='[null]' (Nullable = false) (Size = 6) +@p0=NULL (Nullable = false) +@p1=NULL (Nullable = false) @p2='1' -UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithConverterThatHandlesNulls', json_extract(@p0, '$[0]')), "Reference" = json_set("Reference", '$.TestNullableEnumWithConverterThatHandlesNulls', json_extract(@p1, '$[0]')) +UPDATE "JsonEntitiesAllTypes" SET "Collection" = json_set("Collection", '$[0].TestNullableEnumWithConverterThatHandlesNulls', @p0), "Reference" = json_set("Reference", '$.TestNullableEnumWithConverterThatHandlesNulls', @p1) WHERE "Id" = @p2 RETURNING 1; """, @@ -1187,10 +1187,10 @@ public override async Task Edit_single_property_with_converter_bool_to_int_zero_ AssertSql( """ -@p0='[0]' (Nullable = false) (Size = 3) +@p0='0' (DbType = String) @p1='1' -UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.BoolConvertedToIntZeroOne', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.BoolConvertedToIntZeroOne', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -1209,10 +1209,10 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Tr AssertSql( """ -@p0='["True"]' (Nullable = false) (Size = 8) +@p0='True' (Nullable = false) (Size = 4) @p1='1' -UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.BoolConvertedToStringTrueFalse', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.BoolConvertedToStringTrueFalse', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -1231,10 +1231,10 @@ public override async Task Edit_single_property_with_converter_bool_to_string_Y_ AssertSql( """ -@p0='["N"]' (Nullable = false) (Size = 5) +@p0='N' (Nullable = false) (Size = 1) @p1='1' -UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.BoolConvertedToStringYN', json_extract(@p0, '$[0]')) +UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.BoolConvertedToStringYN', @p0) WHERE "Id" = @p1 RETURNING 1; """, @@ -1253,10 +1253,10 @@ public override async Task Edit_single_property_with_converter_int_zero_one_to_b AssertSql( """ -@p0='["true"]' (Nullable = false) (Size = 8) +@p0='true' (Nullable = false) (Size = 4) @p1='1' -UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.IntZeroOneConvertedToBool', json(json_extract(@p0, '$[0]'))) +UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.IntZeroOneConvertedToBool', json(@p0)) WHERE "Id" = @p1 RETURNING 1; """, @@ -1275,10 +1275,10 @@ public override async Task Edit_single_property_with_converter_string_True_False AssertSql( """ -@p0='["false"]' (Nullable = false) (Size = 9) +@p0='false' (Nullable = false) (Size = 5) @p1='1' -UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.StringTrueFalseConvertedToBool', json(json_extract(@p0, '$[0]'))) +UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.StringTrueFalseConvertedToBool', json(@p0)) WHERE "Id" = @p1 RETURNING 1; """, @@ -1297,10 +1297,10 @@ public override async Task Edit_single_property_with_converter_string_Y_N_to_boo AssertSql( """ -@p0='["true"]' (Nullable = false) (Size = 8) +@p0='true' (Nullable = false) (Size = 4) @p1='1' -UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.StringYNConvertedToBool', json(json_extract(@p0, '$[0]'))) +UPDATE "JsonEntitiesConverters" SET "Reference" = json_set("Reference", '$.StringYNConvertedToBool', json(@p0)) WHERE "Id" = @p1 RETURNING 1; """,