Improve support for primitive collections and Json Types (#159)

pull/162/head
Christopher Jolly 2 years ago committed by GitHub
parent d32eae0867
commit fcb97a4e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,6 +6,7 @@ using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace EntityFrameworkCore.Jet.Metadata.Internal namespace EntityFrameworkCore.Jet.Metadata.Internal
@ -100,6 +101,7 @@ namespace EntityFrameworkCore.Jet.Metadata.Internal
} }
else else
{ {
if (column is JsonColumn) yield break;
property = column.PropertyMappings.First().Property; property = column.PropertyMappings.First().Property;
if (property.DeclaringType is IEntityType entityType) if (property.DeclaringType is IEntityType entityType)
{ {

@ -371,6 +371,17 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
return base.VisitColumn(columnExpression); return base.VisitColumn(columnExpression);
} }
protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExpression)
{
var path = jsonScalarExpression.Path;
if (path.Count == 0)
{
Visit(jsonScalarExpression.Json);
return jsonScalarExpression;
}
return base.VisitJsonScalar(jsonScalarExpression);
}
private bool IsNonComposedSetOperation(SelectExpression selectExpression) private bool IsNonComposedSetOperation(SelectExpression selectExpression)
=> selectExpression.Offset == null => selectExpression.Offset == null
&& selectExpression.Limit == null && selectExpression.Limit == null

@ -7,6 +7,7 @@ using System.Text;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Json;
namespace EntityFrameworkCore.Jet.Storage.Internal namespace EntityFrameworkCore.Jet.Storage.Internal
{ {
@ -29,7 +30,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
StoreTypePostfix? storeTypePostfix = null) StoreTypePostfix? storeTypePostfix = null)
: base( : base(
new RelationalTypeMappingParameters( new RelationalTypeMappingParameters(
new CoreTypeMappingParameters(typeof(byte[]), null, comparer), new CoreTypeMappingParameters(typeof(byte[]), null, comparer, jsonValueReaderWriter: JsonByteArrayReaderWriter.Instance),
storeType ?? (fixedLength ? "binary" : "varbinary"), storeType ?? (fixedLength ? "binary" : "varbinary"),
storeTypePostfix ?? StoreTypePostfix.Size, storeTypePostfix ?? StoreTypePostfix.Size,
System.Data.DbType.Binary, System.Data.DbType.Binary,

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage;
namespace EntityFrameworkCore.Jet.Storage.Internal namespace EntityFrameworkCore.Jet.Storage.Internal
{ {
public class JetDateTimeTypeMapping : RelationalTypeMapping public class JetDateTimeTypeMapping : DateTimeTypeMapping
{ {
private const int MaxDateTimeDoublePrecision = 10; private const int MaxDateTimeDoublePrecision = 10;
private static readonly JetDecimalTypeMapping _decimalTypeMapping = new JetDecimalTypeMapping("decimal", System.Data.DbType.Decimal, 18, 10); private static readonly JetDecimalTypeMapping _decimalTypeMapping = new JetDecimalTypeMapping("decimal", System.Data.DbType.Decimal, 18, 10);
@ -23,7 +23,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
[NotNull] IJetOptions options, [NotNull] IJetOptions options,
DbType? dbType = null, DbType? dbType = null,
[CanBeNull] Type? clrType = null) [CanBeNull] Type? clrType = null)
: base(storeType, clrType ?? typeof(DateTime), dbType ?? System.Data.DbType.DateTime) : base(storeType)
{ {
_options = options; _options = options;
} }

@ -3,6 +3,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Json;
namespace EntityFrameworkCore.Jet.Storage.Internal namespace EntityFrameworkCore.Jet.Storage.Internal
{ {
@ -28,7 +29,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale) StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale)
: base( : base(
new RelationalTypeMappingParameters( new RelationalTypeMappingParameters(
new CoreTypeMappingParameters(typeof(decimal)), new CoreTypeMappingParameters(typeof(decimal), jsonValueReaderWriter: JsonDecimalReaderWriter.Instance),
storeType, storeType,
storeTypePostfix, storeTypePostfix,
dbType) dbType)

@ -0,0 +1,113 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Data.Common;
using System.IO;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Text.Json;
using Microsoft.EntityFrameworkCore.Storage;
namespace EntityFrameworkCore.Jet.Storage.Internal;
/// <summary>
/// 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.
/// </summary>
public class JetJsonTypeMapping : JsonTypeMapping
{
private static readonly MethodInfo GetStringMethod
= typeof(DbDataReader).GetRuntimeMethod(nameof(DbDataReader.GetString), new[] { typeof(int) })!;
private static readonly PropertyInfo UTF8Property
= typeof(Encoding).GetProperty(nameof(Encoding.UTF8))!;
private static readonly MethodInfo EncodingGetBytesMethod
= typeof(Encoding).GetMethod(nameof(Encoding.GetBytes), new[] { typeof(string) })!;
private static readonly ConstructorInfo MemoryStreamConstructor
= typeof(MemoryStream).GetConstructor(new[] { typeof(byte[]) })!;
/// <summary>
/// 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.
/// </summary>
public static JetJsonTypeMapping Default { get; } = new("longchar");
/// <summary>
/// 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.
/// </summary>
public JetJsonTypeMapping(string storeType)
: base(storeType, typeof(JsonElement), System.Data.DbType.String)
{
}
/// <summary>
/// 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.
/// </summary>
public override MethodInfo GetDataReaderMethod()
=> GetStringMethod;
/// <summary>
/// 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.
/// </summary>
public override Expression CustomizeDataReaderExpression(Expression expression)
=> Expression.New(
MemoryStreamConstructor,
Expression.Call(
Expression.Property(null, UTF8Property),
EncodingGetBytesMethod,
expression));
/// <summary>
/// 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.
/// </summary>
protected JetJsonTypeMapping(RelationalTypeMappingParameters parameters)
: base(parameters)
{
}
/// <summary>
/// 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.
/// </summary>
protected virtual string EscapeSqlLiteral(string literal)
=> literal.Replace("'", "''");
/// <summary>
/// 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.
/// </summary>
protected override string GenerateNonNullSqlLiteral(object value)
=> $"'{EscapeSqlLiteral(JsonSerializer.Serialize(value))}'";
/// <summary>
/// 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.
/// </summary>
protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters)
=> new JetJsonTypeMapping(parameters);
}

@ -5,6 +5,7 @@ using System.Data;
using System.Data.Common; using System.Data.Common;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Json;
namespace EntityFrameworkCore.Jet.Storage.Internal namespace EntityFrameworkCore.Jet.Storage.Internal
{ {
@ -30,7 +31,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
bool keepLineBreakCharacters = false) bool keepLineBreakCharacters = false)
: this( : this(
new RelationalTypeMappingParameters( new RelationalTypeMappingParameters(
new CoreTypeMappingParameters(typeof(string)), new CoreTypeMappingParameters(typeof(string), jsonValueReaderWriter: JsonStringReaderWriter.Instance),
storeType ?? GetStoreName(fixedLength), storeType ?? GetStoreName(fixedLength),
storeTypePostfix ?? StoreTypePostfix.Size, storeTypePostfix ?? StoreTypePostfix.Size,
(fixedLength (fixedLength

@ -5,11 +5,13 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text.Json;
using EntityFrameworkCore.Jet.Infrastructure.Internal; using EntityFrameworkCore.Jet.Infrastructure.Internal;
using EntityFrameworkCore.Jet.Internal; using EntityFrameworkCore.Jet.Internal;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
namespace EntityFrameworkCore.Jet.Storage.Internal namespace EntityFrameworkCore.Jet.Storage.Internal
@ -53,7 +55,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
private readonly JetStringTypeMapping _variableLengthUnicodeString = new JetStringTypeMapping("varchar", unicode: true); private readonly JetStringTypeMapping _variableLengthUnicodeString = new JetStringTypeMapping("varchar", unicode: true);
private readonly JetStringTypeMapping _variableLengthMaxUnicodeString = new JetStringTypeMapping("varchar(max)", unicode: true, storeTypePostfix: StoreTypePostfix.None); private readonly JetStringTypeMapping _variableLengthMaxUnicodeString = new JetStringTypeMapping("varchar(max)", unicode: true, storeTypePostfix: StoreTypePostfix.None);
private readonly JetStringTypeMapping _unboundedUnicodeString = new JetStringTypeMapping("longchar", unicode: true, storeTypePostfix: StoreTypePostfix.None); private readonly JetStringTypeMapping _unboundedUnicodeString = new JetStringTypeMapping("longchar", unicode: true, storeTypePostfix: StoreTypePostfix.None);
private readonly JetJsonTypeMapping _jsonTypeMapping = new JetJsonTypeMapping("longchar");
private readonly JetGuidTypeMapping _guid = new JetGuidTypeMapping("uniqueidentifier", DbType.Guid); private readonly JetGuidTypeMapping _guid = new JetGuidTypeMapping("uniqueidentifier", DbType.Guid);
private readonly JetByteArrayTypeMapping _rowversion = new JetByteArrayTypeMapping("varbinary", size: 8, private readonly JetByteArrayTypeMapping _rowversion = new JetByteArrayTypeMapping("varbinary", size: 8,
comparer: new ValueComparer<byte[]>( comparer: new ValueComparer<byte[]>(
@ -202,6 +204,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
{typeof(TimeSpan), _timespan}, {typeof(TimeSpan), _timespan},
{typeof(TimeOnly), _timeonly}, {typeof(TimeOnly), _timeonly},
{typeof(Guid), _guid}, {typeof(Guid), _guid},
{ typeof(JsonElement), _jsonTypeMapping }
}; };
// These are disallowed only if specified without any kind of length specified in parenthesis. // These are disallowed only if specified without any kind of length specified in parenthesis.
@ -261,7 +264,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
/// directly from your code. This API may change or be removed in future releases. /// directly from your code. This API may change or be removed in future releases.
/// </summary> /// </summary>
protected override RelationalTypeMapping? FindMapping(in RelationalTypeMappingInfo mappingInfo) protected override RelationalTypeMapping? FindMapping(in RelationalTypeMappingInfo mappingInfo)
=> base.FindMapping(mappingInfo) ?? FindRawMapping(mappingInfo)?.Clone(mappingInfo); => base.FindMapping(mappingInfo)
?? FindRawMapping(mappingInfo)?.WithTypeMappingInfo(mappingInfo);
/// <summary> /// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used /// This API supports the Entity Framework Core infrastructure and is not intended to be used
@ -355,6 +359,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
return _rowversion; return _rowversion;
} }
if (mappingInfo.ElementTypeMapping == null)
{
var isFixedLength = mappingInfo.IsFixedLength == true; var isFixedLength = mappingInfo.IsFixedLength == true;
const int maxBinaryColumnSize = 510; const int maxBinaryColumnSize = 510;
@ -374,6 +380,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
: _variableLengthBinary.StoreTypeNameBase); : _variableLengthBinary.StoreTypeNameBase);
} }
} }
}
return null; return null;
} }

@ -4,6 +4,7 @@
#nullable enable #nullable enable
using System; using System;
using System.Collections.Generic;
using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Xunit; using Xunit;
@ -13,20 +14,54 @@ namespace EntityFrameworkCore.Jet.FunctionalTests;
public class JsonTypesJetTest : JsonTypesRelationalTestBase public class JsonTypesJetTest : JsonTypesRelationalTestBase
{ {
// #25765 - the Jet type mapping source doesn't support primitive collections, so we end up with a Property public override void Can_read_write_ulong_enum_JSON_values(EnumU64 value, string json)
// that has no ElementType; that causes the assertion on the element nullability to fail. {
public override void Can_read_write_collection_of_string_JSON_values() if (value == EnumU64.Max)
=> Assert.Throws<EqualException>(() => base.Can_read_write_collection_of_string_JSON_values()); {
json = """{"Prop":-1}"""; // Because ulong is converted to long on Jet
// #25765 - the Jet type mapping source doesn't support primitive collections, so we end up with a Property }
// that has no ElementType; that causes the assertion on the element nullability to fail.
public override void Can_read_write_collection_of_binary_JSON_values() base.Can_read_write_ulong_enum_JSON_values(value, json);
=> Assert.Throws<EqualException>(() => base.Can_read_write_collection_of_binary_JSON_values()); }
// #25765 - the Jet type mapping source doesn't support primitive collections, so we end up with a Property public override void Can_read_write_nullable_ulong_enum_JSON_values(object? value, string json)
// that has no ElementType; that causes the assertion on the element nullability to fail. {
public override void Can_read_write_collection_of_nullable_string_JSON_values() if (Equals(value, ulong.MaxValue))
=> Assert.Throws<EqualException>(() => base.Can_read_write_collection_of_nullable_string_JSON_values()); {
json = """{"Prop":-1}"""; // Because ulong is converted to long on Jet
}
base.Can_read_write_nullable_ulong_enum_JSON_values(value, json);
}
public override void Can_read_write_collection_of_ulong_enum_JSON_values()
=> Can_read_and_write_JSON_value<EnumU64CollectionType, List<EnumU64>>(
nameof(EnumU64CollectionType.EnumU64),
new List<EnumU64>
{
EnumU64.Min,
EnumU64.Max,
EnumU64.Default,
EnumU64.One,
(EnumU64)8
},
"""{"Prop":[0,-1,0,1,8]}""", // Because ulong is converted to long on Jet
mappedCollection: true);
public override void Can_read_write_collection_of_nullable_ulong_enum_JSON_values()
=> Can_read_and_write_JSON_value<NullableEnumU64CollectionType, List<EnumU64?>>(
nameof(NullableEnumU64CollectionType.EnumU64),
new List<EnumU64?>
{
EnumU64.Min,
null,
EnumU64.Max,
EnumU64.Default,
EnumU64.One,
(EnumU64?)8
},
"""{"Prop":[0,null,-1,0,1,8]}""", // Because ulong is converted to long on Jet
mappedCollection: true);
public override void Can_read_write_point() public override void Can_read_write_point()
// No built-in JSON support for spatial types in the Jet provider // No built-in JSON support for spatial types in the Jet provider

@ -43,7 +43,7 @@ public class JsonQueryAdHocJetTest : JsonQueryAdHocTestBase
ctx.SaveChanges(); ctx.SaveChanges();
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Reference], [Collection]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Reference], [Collection])
VALUES(3, N'{{ ""NonNullableScalar"" : 30 }}', N'[{{ ""NonNullableScalar"" : 10001 }}]')"); VALUES(3, '{{ ""NonNullableScalar"" : 30 }}', '[{{ ""NonNullableScalar"" : 10001 }}]')");
} }
protected override void Seed30028(MyContext30028 ctx) protected override void Seed30028(MyContext30028 ctx)
@ -52,25 +52,25 @@ VALUES(3, N'{{ ""NonNullableScalar"" : 30 }}', N'[{{ ""NonNullableScalar"" : 100
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json])
VALUES( VALUES(
1, 1,
N'{{""RootName"":""e1"",""Collection"":[{{""BranchName"":""e1 c1"",""Nested"":{{""LeafName"":""e1 c1 l""}}}},{{""BranchName"":""e1 c2"",""Nested"":{{""LeafName"":""e1 c2 l""}}}}],""OptionalReference"":{{""BranchName"":""e1 or"",""Nested"":{{""LeafName"":""e1 or l""}}}},""RequiredReference"":{{""BranchName"":""e1 rr"",""Nested"":{{""LeafName"":""e1 rr l""}}}}}}')"); '{{""RootName"":""e1"",""Collection"":[{{""BranchName"":""e1 c1"",""Nested"":{{""LeafName"":""e1 c1 l""}}}},{{""BranchName"":""e1 c2"",""Nested"":{{""LeafName"":""e1 c2 l""}}}}],""OptionalReference"":{{""BranchName"":""e1 or"",""Nested"":{{""LeafName"":""e1 or l""}}}},""RequiredReference"":{{""BranchName"":""e1 rr"",""Nested"":{{""LeafName"":""e1 rr l""}}}}}}')");
// missing collection // missing collection
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json])
VALUES( VALUES(
2, 2,
N'{{""RootName"":""e2"",""OptionalReference"":{{""BranchName"":""e2 or"",""Nested"":{{""LeafName"":""e2 or l""}}}},""RequiredReference"":{{""BranchName"":""e2 rr"",""Nested"":{{""LeafName"":""e2 rr l""}}}}}}')"); '{{""RootName"":""e2"",""OptionalReference"":{{""BranchName"":""e2 or"",""Nested"":{{""LeafName"":""e2 or l""}}}},""RequiredReference"":{{""BranchName"":""e2 rr"",""Nested"":{{""LeafName"":""e2 rr l""}}}}}}')");
// missing optional reference // missing optional reference
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json])
VALUES( VALUES(
3, 3,
N'{{""RootName"":""e3"",""Collection"":[{{""BranchName"":""e3 c1"",""Nested"":{{""LeafName"":""e3 c1 l""}}}},{{""BranchName"":""e3 c2"",""Nested"":{{""LeafName"":""e3 c2 l""}}}}],""RequiredReference"":{{""BranchName"":""e3 rr"",""Nested"":{{""LeafName"":""e3 rr l""}}}}}}')"); '{{""RootName"":""e3"",""Collection"":[{{""BranchName"":""e3 c1"",""Nested"":{{""LeafName"":""e3 c1 l""}}}},{{""BranchName"":""e3 c2"",""Nested"":{{""LeafName"":""e3 c2 l""}}}}],""RequiredReference"":{{""BranchName"":""e3 rr"",""Nested"":{{""LeafName"":""e3 rr l""}}}}}}')");
// missing required reference // missing required reference
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Id], [Json])
VALUES( VALUES(
4, 4,
N'{{""RootName"":""e4"",""Collection"":[{{""BranchName"":""e4 c1"",""Nested"":{{""LeafName"":""e4 c1 l""}}}},{{""BranchName"":""e4 c2"",""Nested"":{{""LeafName"":""e4 c2 l""}}}}],""OptionalReference"":{{""BranchName"":""e4 or"",""Nested"":{{""LeafName"":""e4 or l""}}}}}}')"); '{{""RootName"":""e4"",""Collection"":[{{""BranchName"":""e4 c1"",""Nested"":{{""LeafName"":""e4 c1 l""}}}},{{""BranchName"":""e4 c2"",""Nested"":{{""LeafName"":""e4 c2 l""}}}}],""OptionalReference"":{{""BranchName"":""e4 or"",""Nested"":{{""LeafName"":""e4 or l""}}}}}}')");
} }
protected override void SeedArrayOfPrimitives(MyContextArrayOfPrimitives ctx) protected override void SeedArrayOfPrimitives(MyContextArrayOfPrimitives ctx)
@ -129,10 +129,10 @@ N'{{""RootName"":""e4"",""Collection"":[{{""BranchName"":""e4 c1"",""Nested"":{{
{ {
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Collection], [CollectionWithCtor], [Reference], [ReferenceWithCtor], [Id]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Collection], [CollectionWithCtor], [Reference], [ReferenceWithCtor], [Id])
VALUES( VALUES(
N'[{{""JunkReference"":{{""Something"":""SomeValue"" }},""Name"":""c11"",""JunkProperty1"":50,""Number"":11.5,""JunkCollection1"":[],""JunkCollection2"":[{{""Foo"":""junk value""}}],""NestedCollection"":[{{""DoB"":""2002-04-01T00:00:00"",""DummyProp"":""Dummy value""}},{{""DoB"":""2002-04-02T00:00:00"",""DummyReference"":{{""Foo"":5}}}}],""NestedReference"":{{""DoB"":""2002-03-01T00:00:00""}}}},{{""Name"":""c12"",""Number"":12.5,""NestedCollection"":[{{""DoB"":""2002-06-01T00:00:00""}},{{""DoB"":""2002-06-02T00:00:00""}}],""NestedDummy"":59,""NestedReference"":{{""DoB"":""2002-05-01T00:00:00""}}}}]', '[{{""JunkReference"":{{""Something"":""SomeValue"" }},""Name"":""c11"",""JunkProperty1"":50,""Number"":11.5,""JunkCollection1"":[],""JunkCollection2"":[{{""Foo"":""junk value""}}],""NestedCollection"":[{{""DoB"":""2002-04-01T00:00:00"",""DummyProp"":""Dummy value""}},{{""DoB"":""2002-04-02T00:00:00"",""DummyReference"":{{""Foo"":5}}}}],""NestedReference"":{{""DoB"":""2002-03-01T00:00:00""}}}},{{""Name"":""c12"",""Number"":12.5,""NestedCollection"":[{{""DoB"":""2002-06-01T00:00:00""}},{{""DoB"":""2002-06-02T00:00:00""}}],""NestedDummy"":59,""NestedReference"":{{""DoB"":""2002-05-01T00:00:00""}}}}]',
N'[{{""MyBool"":true,""Name"":""c11 ctor"",""JunkReference"":{{""Something"":""SomeValue"",""JunkCollection"":[{{""Foo"":""junk value""}}]}},""NestedCollection"":[{{""DoB"":""2002-08-01T00:00:00""}},{{""DoB"":""2002-08-02T00:00:00""}}],""NestedReference"":{{""DoB"":""2002-07-01T00:00:00""}}}},{{""MyBool"":false,""Name"":""c12 ctor"",""NestedCollection"":[{{""DoB"":""2002-10-01T00:00:00""}},{{""DoB"":""2002-10-02T00:00:00""}}],""JunkCollection"":[{{""Foo"":""junk value""}}],""NestedReference"":{{""DoB"":""2002-09-01T00:00:00""}}}}]', '[{{""MyBool"":true,""Name"":""c11 ctor"",""JunkReference"":{{""Something"":""SomeValue"",""JunkCollection"":[{{""Foo"":""junk value""}}]}},""NestedCollection"":[{{""DoB"":""2002-08-01T00:00:00""}},{{""DoB"":""2002-08-02T00:00:00""}}],""NestedReference"":{{""DoB"":""2002-07-01T00:00:00""}}}},{{""MyBool"":false,""Name"":""c12 ctor"",""NestedCollection"":[{{""DoB"":""2002-10-01T00:00:00""}},{{""DoB"":""2002-10-02T00:00:00""}}],""JunkCollection"":[{{""Foo"":""junk value""}}],""NestedReference"":{{""DoB"":""2002-09-01T00:00:00""}}}}]',
N'{{""Name"":""r1"",""JunkCollection"":[{{""Foo"":""junk value""}}],""JunkReference"":{{""Something"":""SomeValue"" }},""Number"":1.5,""NestedCollection"":[{{""DoB"":""2000-02-01T00:00:00"",""JunkReference"":{{""Something"":""SomeValue""}}}},{{""DoB"":""2000-02-02T00:00:00""}}],""NestedReference"":{{""DoB"":""2000-01-01T00:00:00""}}}}', '{{""Name"":""r1"",""JunkCollection"":[{{""Foo"":""junk value""}}],""JunkReference"":{{""Something"":""SomeValue"" }},""Number"":1.5,""NestedCollection"":[{{""DoB"":""2000-02-01T00:00:00"",""JunkReference"":{{""Something"":""SomeValue""}}}},{{""DoB"":""2000-02-02T00:00:00""}}],""NestedReference"":{{""DoB"":""2000-01-01T00:00:00""}}}}',
N'{{""MyBool"":true,""JunkCollection"":[{{""Foo"":""junk value""}}],""Name"":""r1 ctor"",""JunkReference"":{{""Something"":""SomeValue"" }},""NestedCollection"":[{{""DoB"":""2001-02-01T00:00:00""}},{{""DoB"":""2001-02-02T00:00:00""}}],""NestedReference"":{{""JunkCollection"":[{{""Foo"":""junk value""}}],""DoB"":""2001-01-01T00:00:00""}}}}', '{{""MyBool"":true,""JunkCollection"":[{{""Foo"":""junk value""}}],""Name"":""r1 ctor"",""JunkReference"":{{""Something"":""SomeValue"" }},""NestedCollection"":[{{""DoB"":""2001-02-01T00:00:00""}},{{""DoB"":""2001-02-02T00:00:00""}}],""NestedReference"":{{""JunkCollection"":[{{""Foo"":""junk value""}}],""DoB"":""2001-01-01T00:00:00""}}}}',
1)"); 1)");
} }
@ -140,11 +140,11 @@ N'{{""MyBool"":true,""JunkCollection"":[{{""Foo"":""junk value""}}],""Name"":""r
{ {
ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Collection], [CollectionWithCtor], [Reference], [ReferenceWithCtor], [Id], [Name]) ctx.Database.ExecuteSqlRaw(@"INSERT INTO [Entities] ([Collection], [CollectionWithCtor], [Reference], [ReferenceWithCtor], [Id], [Name])
VALUES( VALUES(
N'[{{""Name"":""e1_c1"",""ShadowDouble"":5.5}},{{""ShadowDouble"":20.5,""Name"":""e1_c2""}}]', '[{{""Name"":""e1_c1"",""ShadowDouble"":5.5}},{{""ShadowDouble"":20.5,""Name"":""e1_c2""}}]',
N'[{{""Name"":""e1_c1 ctor"",""ShadowNullableByte"":6}},{{""ShadowNullableByte"":null,""Name"":""e1_c2 ctor""}}]', '[{{""Name"":""e1_c1 ctor"",""ShadowNullableByte"":6}},{{""ShadowNullableByte"":null,""Name"":""e1_c2 ctor""}}]',
N'{{""Name"":""e1_r"", ""ShadowString"":""Foo""}}', '{{""Name"":""e1_r"", ""ShadowString"":""Foo""}}',
N'{{""ShadowInt"":143,""Name"":""e1_r ctor""}}', '{{""ShadowInt"":143,""Name"":""e1_r ctor""}}',
1, 1,
N'e1')"); 'e1')");
} }
} }

@ -18,7 +18,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query;
/// This exercises the older translation paths for e.g. Contains, to make sure things work for providers with no queryable constant/ /// This exercises the older translation paths for e.g. Contains, to make sure things work for providers with no queryable constant/
/// parameter support. /// parameter support.
/// </summary> /// </summary>
public class PrimitiveCollectionsQueryJetTest : PrimitiveCollectionsQueryTestBase< public class PrimitiveCollectionsQueryJetTest : PrimitiveCollectionsQueryRelationalTestBase<
PrimitiveCollectionsQueryJetTest.PrimitiveCollectionsQueryJetFixture> PrimitiveCollectionsQueryJetTest.PrimitiveCollectionsQueryJetFixture>
{ {
public PrimitiveCollectionsQueryJetTest(PrimitiveCollectionsQueryJetFixture fixture, ITestOutputHelper testOutputHelper) public PrimitiveCollectionsQueryJetTest(PrimitiveCollectionsQueryJetFixture fixture, ITestOutputHelper testOutputHelper)
@ -34,9 +34,9 @@ public class PrimitiveCollectionsQueryJetTest : PrimitiveCollectionsQueryTestBas
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Int] IN (10, 999) WHERE `p`.`Int` IN (10, 999)
"""); """);
} }
@ -46,9 +46,9 @@ WHERE [p].[Int] IN (10, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[NullableInt] IN (10, 999) WHERE `p`.`NullableInt` IN (10, 999)
"""); """);
} }
@ -58,9 +58,9 @@ WHERE [p].[NullableInt] IN (10, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[NullableInt] IS NULL OR [p].[NullableInt] = 999 WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999
"""); """);
} }
@ -125,9 +125,9 @@ WHERE (
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] = 2 WHERE `p`.`Id` = 2
"""); """);
} }
@ -137,9 +137,9 @@ WHERE [p].[Id] = 2
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] IN (2, 999) WHERE `p`.`Id` IN (2, 999)
"""); """);
} }
@ -149,9 +149,9 @@ WHERE [p].[Id] IN (2, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] IN (2, 999, 1000) WHERE `p`.`Id` IN (2, 999, 1000)
"""); """);
} }
@ -164,9 +164,9 @@ WHERE [p].[Id] IN (2, 999, 1000)
@__i_0='2' @__i_0='2'
@__j_1='999' @__j_1='999'
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] IN (@__i_0, @__j_1) WHERE `p`.`Id` IN (@__i_0, @__j_1)
"""); """);
} }
@ -178,9 +178,9 @@ WHERE [p].[Id] IN (@__i_0, @__j_1)
""" """
@__j_0='999' @__j_0='999'
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] IN (2, @__j_0) WHERE `p`.`Id` IN (2, @__j_0)
"""); """);
} }
@ -192,9 +192,9 @@ WHERE [p].[Id] IN (2, @__j_0)
""" """
@__i_0='11' @__i_0='11'
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Int] IN (999, @__i_0, [p].[Id], [p].[Id] + [p].[Int]) WHERE `p`.`Int` IN (999, @__i_0, `p`.`Id`, `p`.`Id` + `p`.`Int`)
"""); """);
} }
@ -204,9 +204,9 @@ WHERE [p].[Int] IN (999, @__i_0, [p].[Id], [p].[Id] + [p].[Int])
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] IN (2, 999) WHERE `p`.`Id` IN (2, 999)
"""); """);
} }
@ -216,9 +216,9 @@ WHERE [p].[Id] IN (2, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] NOT IN (2, 999) WHERE `p`.`Id` NOT IN (2, 999)
"""); """);
} }
@ -233,9 +233,9 @@ WHERE [p].[Id] NOT IN (2, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Int] IN (10, 999) WHERE `p`.`Int` IN (10, 999)
"""); """);
} }
@ -245,9 +245,9 @@ WHERE [p].[Int] IN (10, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Int] IN (10, 999) WHERE `p`.`Int` IN (10, 999)
"""); """);
} }
@ -257,9 +257,9 @@ WHERE [p].[Int] IN (10, 999)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[NullableInt] IS NULL OR [p].[NullableInt] = 999 WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999
"""); """);
} }
@ -269,9 +269,9 @@ WHERE [p].[NullableInt] IS NULL OR [p].[NullableInt] = 999
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[String] IN (N'10', N'999') WHERE `p`.`String` IN ('10', '999')
"""); """);
} }
@ -281,9 +281,9 @@ WHERE [p].[String] IN (N'10', N'999')
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[NullableString] IS NULL OR [p].[NullableString] = N'999' WHERE `p`.`NullableString` IS NULL OR `p`.`NullableString` = '999'
"""); """);
} }
@ -293,9 +293,9 @@ WHERE [p].[NullableString] IS NULL OR [p].[NullableString] = N'999'
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[DateTime] IN ('2020-01-10T12:30:00.0000000Z', '9999-01-01T00:00:00.0000000Z') WHERE `p`.`DateTime` IN (#2020-01-10 12:30:00#, #9999-01-01#)
"""); """);
} }
@ -305,9 +305,9 @@ WHERE [p].[DateTime] IN ('2020-01-10T12:30:00.0000000Z', '9999-01-01T00:00:00.00
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Bool] = CAST(1 AS bit) WHERE `p`.`Bool` = TRUE
"""); """);
} }
@ -317,9 +317,9 @@ WHERE [p].[Bool] = CAST(1 AS bit)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Enum] IN (0, 3) WHERE `p`.`Enum` IN (0, 3)
"""); """);
} }
@ -329,8 +329,8 @@ WHERE [p].[Enum] IN (0, 3)
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE 0 = 1 WHERE 0 = 1
"""); """);
} }
@ -480,9 +480,9 @@ WHERE (
AssertSql( AssertSql(
""" """
SELECT [p].[Ints] SELECT `p`.`Ints`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
ORDER BY [p].[Id] ORDER BY `p`.`Id`
"""); """);
} }
@ -520,11 +520,11 @@ ORDER BY [p].[Id]
AssertSql( AssertSql(
""" """
@__ints_0='[1,10]' (Size = 4000) @__ints_0='[1,10]' (Size = 255)
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Ints] = @__ints_0 WHERE `p`.`Ints` = @__ints_0
"""); """);
} }
@ -534,9 +534,9 @@ WHERE [p].[Ints] = @__ints_0
AssertSql( AssertSql(
""" """
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Ints] = N'[1,10]' WHERE `p`.`Ints` = '[1,10]'
"""); """);
} }
@ -587,9 +587,9 @@ WHERE [p].[Ints] = N'[1,10]'
AssertSql( AssertSql(
""" """
SELECT [p].[Ints] SELECT `p`.`Ints`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
ORDER BY [p].[Id] ORDER BY `p`.`Id`
"""); """);
} }
@ -609,9 +609,9 @@ ORDER BY [p].[Id]
// client eval // client eval
AssertSql( AssertSql(
""" """
SELECT [p].[Ints] SELECT `p`.`Ints`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
ORDER BY [p].[Id] ORDER BY `p`.`Id`
"""); """);
} }
@ -636,10 +636,10 @@ ORDER BY [p].[Id]
AssertSql( AssertSql(
""" """
SELECT [p].[Ints], [p].[DateTimes], [p].[Strings] SELECT `p`.`Ints`, `p`.`DateTimes`, `p`.`Strings`
FROM [PrimitiveCollectionsEntity] AS [p] FROM `PrimitiveCollectionsEntity` AS `p`
WHERE [p].[Id] < 4 WHERE `p`.`Id` < 4
ORDER BY [p].[Id] ORDER BY `p`.`Id`
"""); """);
} }

Loading…
Cancel
Save