From 02fa0d2387eee9a8b4e45d053069cfe755446ac4 Mon Sep 17 00:00:00 2001 From: Arthur Vickers Date: Fri, 19 Jul 2024 10:48:02 +0100 Subject: [PATCH] Enabled key converter tests for Cosmos Fixes #26239 (The bug has already been fixed as part of the 9.0 work.) --- .../KeysWithConvertersCosmosTest.cs | 541 +--------- .../KeysWithConvertersTestBase.cs | 938 +++++++++++++----- 2 files changed, 684 insertions(+), 795 deletions(-) diff --git a/test/EFCore.Cosmos.FunctionalTests/KeysWithConvertersCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/KeysWithConvertersCosmosTest.cs index c06af99c669..97dddb936c0 100644 --- a/test/EFCore.Cosmos.FunctionalTests/KeysWithConvertersCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/KeysWithConvertersCosmosTest.cs @@ -7,545 +7,20 @@ namespace Microsoft.EntityFrameworkCore; public class KeysWithConvertersCosmosTest(KeysWithConvertersCosmosTest.KeysWithConvertersCosmosFixture fixture) : KeysWithConvertersTestBase(fixture) { - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_struct_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_comparable_struct_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_generic_comparable_struct_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_key_and_required_dependents() - => base.Can_insert_and_read_back_with_struct_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_key_and_required_dependents() - => base.Can_insert_and_read_back_with_comparable_struct_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_key_and_required_dependents() - => base.Can_insert_and_read_back_with_generic_comparable_struct_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_class_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_class_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_class_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_comparable_class_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_binary_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_comparable_struct_binary_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_binary_key_and_required_dependents() - => base.Can_insert_and_read_back_with_comparable_struct_binary_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_required_dependents() - => base.Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_structural_struct_binary_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_structural_struct_binary_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_structural_struct_binary_key_and_required_dependents() - => base.Can_insert_and_read_back_with_structural_struct_binary_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_binary_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_struct_binary_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_binary_key_and_required_dependents() - => base.Can_insert_and_read_back_with_struct_binary_key_and_required_dependents(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_binary_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_comparable_struct_binary_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_binary_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_comparable_struct_binary_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_comparable_struct_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_comparable_struct_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_comparable_struct_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_generic_comparable_struct_binary_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_generic_comparable_struct_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_generic_comparable_struct_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_generic_comparable_struct_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_binary_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_struct_binary_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_struct_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_binary_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_struct_binary_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_struct_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_struct_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_structural_struct_binary_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_structural_struct_binary_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#16920 (Include)")] - public override Task Can_insert_and_read_back_with_structural_struct_binary_key_and_required_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_structural_struct_binary_key_and_required_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#26239")] - public override Task Can_insert_and_read_back_with_bare_class_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_bare_class_key_and_optional_dependents(); - - [ConditionalFact(Skip = "Issue=#26239")] - public override Task Can_insert_and_read_back_with_class_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_class_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#26239")] - public override Task Can_insert_and_read_back_with_bare_class_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_bare_class_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#26239")] - public override Task Can_insert_and_read_back_with_comparable_class_key_and_optional_dependents_with_shadow_FK() - => base.Can_insert_and_read_back_with_comparable_class_key_and_optional_dependents_with_shadow_FK(); - - [ConditionalFact(Skip = "Issue=#26239")] - public override Task Can_insert_and_read_back_with_enumerable_class_key_and_optional_dependents() - => base.Can_insert_and_read_back_with_enumerable_class_key_and_optional_dependents(); - public class KeysWithConvertersCosmosFixture : KeysWithConvertersFixtureBase { protected override ITestStoreFactory TestStoreFactory => CosmosTestStoreFactory.Instance; - protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) - { - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(IntStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(IntStructKey.Converter); - }); - - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - // b.HasMany(e => e.OptionalDependents).WithOne(e => e.Principal).HasForeignKey(e => e.PrincipalId); - // b.HasMany(e => e.RequiredDependents).WithOne(e => e.Principal).HasForeignKey(e => e.PrincipalId); - // }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - // b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter); - // }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - // b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter); - // }); - - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - // b.Property(e => e.PrincipalId).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - // }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - // b.Property(e => e.PrincipalId).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - // }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(ComparableIntStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(ComparableIntStructKey.Converter); - }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntStructKey.Converter); - }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(StructuralComparableBytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(StructuralComparableBytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(BytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(BytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(ComparableBytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(ComparableBytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableBytesStructKey.Converter); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableBytesStructKey.Converter); - }); - - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); - // b.Property(e => e.PrincipalId).HasConversion(ComparableIntClassKey.Converter); - // }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); - // b.Property(e => e.PrincipalId).HasConversion(ComparableIntClassKey.Converter); - // }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); - // b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntClassKey.Converter); - // }); - // - // modelBuilder.Entity( - // b => - // { - // b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); - // b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntClassKey.Converter); - // }); - - modelBuilder.Entity( - entity => - { - entity.HasKey(e => e.Name); - - entity.Property(p => p.Name) - .HasConversion( - p => p.Value, - p => new Key(p), - new ValueComparer( - (l, r) => (l == null && r == null) || (l != null && r != null && l.Value == r.Value), - v => v == null ? 0 : v.Value.GetHashCode())); - - entity.OwnsOne(p => p.Text); - entity.Navigation(p => p.Text).IsRequired(); - }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); - - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); - - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); - // - // modelBuilder.Entity( - // b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); - b.OwnsOne(e => e.Owned); - }); - - modelBuilder.Ignore(); - modelBuilder.Ignore(); - modelBuilder.Ignore(); - } + public override bool UseInclude + => false; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder.ConfigureWarnings( - w => w.Ignore(CoreEventId.MappedEntityTypeIgnoredWarning, CosmosEventId.NoPartitionKeyDefined))); + => base.AddOptions( + builder.ConfigureWarnings( + w => w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CosmosEventId.NoPartitionKeyDefined, + CoreEventId.CollectionWithoutComparer))); } } diff --git a/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs b/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs index de6c348506f..e3a55d74e76 100644 --- a/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs +++ b/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs @@ -71,17 +71,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new IntStructKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = two })), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 4 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = two })), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 4 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new IntStructKey(103); var oneOhFive = 105; @@ -169,17 +181,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new ComparableIntStructKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = two })), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 4 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = two })), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 4 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new ComparableIntStructKey(103); var oneOhFive = 105; @@ -277,18 +301,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new GenericComparableIntStructKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = two })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 4 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = two })), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 4 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new GenericComparableIntStructKey(103); var oneOhFive = 105; @@ -390,17 +425,29 @@ async Task RunQueries(DbContext context) var twelve = 12; var thirteen = new IntStructKey { Id = 13 }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 11 })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents).SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 14 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 11 })), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 14 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = 112; var oneThirteen = new IntStructKey { Id = 113 }; var oneFifteeen = 115; @@ -489,18 +536,29 @@ async Task RunQueries(DbContext context) var twelve = 12; var thirteen = new ComparableIntStructKey { Id = 13 }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 11 })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 14 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 11 })), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 14 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = 112; var oneThirteen = new ComparableIntStructKey { Id = 113 }; var oneFifteeen = 115; @@ -598,18 +656,29 @@ async Task RunQueries(DbContext context) var twelve = 12; var thirteen = new GenericComparableIntStructKey { Id = 13 }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 11 })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 14 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 11 })), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 14 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = 112; var oneThirteen = new GenericComparableIntStructKey { Id = 113 }; var oneFifteeen = 115; @@ -711,17 +780,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new IntClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new IntClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new IntClassKey(103); var oneOhFive = 105; @@ -809,17 +890,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new EnumerableClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new EnumerableClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new EnumerableClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new EnumerableClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new EnumerableClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new EnumerableClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new EnumerableClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new EnumerableClassKey(103); var oneOhFive = 105; @@ -907,17 +1000,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new BareIntClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BareIntClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BareIntClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BareIntClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new BareIntClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new BareIntClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new BareIntClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new BareIntClassKey(103); var oneOhFive = 105; @@ -1005,17 +1110,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new ComparableIntClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new ComparableIntClassKey(103); var oneOhFive = 105; @@ -1109,18 +1226,29 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new BytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey(two))), - (await context.Set().Include(e => e.OptionalDependents).Where(e => e.Id.Equals(three)).ToListAsync()) - .Single(), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey(two))), + (await principalQuery.Where(e => e.Id.Equals(three)).ToListAsync()).Single(), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new BytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -1215,18 +1343,31 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new StructuralComparableBytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(two))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync( e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new StructuralComparableBytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -1333,18 +1474,29 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new ComparableBytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(two))), - (await context.Set().Include(e => e.OptionalDependents).ToListAsync()) - .Where(e => e.Id.Equals(three)).ToList().Single(), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(two))), + (await principalQuery.ToListAsync()).Where(e => e.Id.Equals(three)).ToList().Single(), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new ComparableBytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -1446,18 +1598,29 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new GenericComparableBytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey(two))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new GenericComparableBytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -1562,17 +1725,29 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new BytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents).SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new BytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -1666,18 +1841,29 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new ComparableBytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new ComparableBytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -1782,18 +1968,31 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new StructuralComparableBytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync( e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new StructuralComparableBytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -1900,18 +2099,30 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new GenericComparableBytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync( e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new GenericComparableBytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -2371,17 +2582,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new IntStructKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new IntStructKey(103); var oneOhFive = 105; @@ -2518,17 +2741,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new ComparableIntStructKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new ComparableIntStructKey(103); var oneOhFive = 105; @@ -2688,18 +2923,30 @@ async Task RunQueries(DbContext context) var two = 2; var three = new GenericComparableIntStructKey(3); + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(two))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new GenericComparableIntStructKey(103); var oneOhFive = 105; @@ -2848,17 +3095,29 @@ async Task RunQueries(DbContext context) var twelve = 12; var thirteen = new IntStructKey { Id = 13 }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 11 })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents).SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 14 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 11 })), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntStructKey { Id = 14 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = 112; var oneThirteen = new IntStructKey { Id = 113 }; var oneFifteeen = 115; @@ -2993,18 +3252,29 @@ async Task RunQueries(DbContext context) var twelve = 12; var thirteen = new ComparableIntStructKey { Id = 13 }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 11 })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 14 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 11 })), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntStructKey { Id = 14 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = 112; var oneThirteen = new ComparableIntStructKey { Id = 113 }; var oneFifteeen = 115; @@ -3166,18 +3436,30 @@ async Task RunQueries(DbContext context) var twelve = 12; var thirteen = new GenericComparableIntStructKey { Id = 13 }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 11 })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 14 })) + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 11 })), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 14 })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = 112; var oneThirteen = new GenericComparableIntStructKey { Id = 113 }; var oneFifteeen = 115; @@ -3326,17 +3608,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new IntClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new IntClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new IntClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new IntClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new IntClassKey(103); var oneOhFive = 105; @@ -3472,17 +3766,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new BareIntClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BareIntClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BareIntClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BareIntClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new BareIntClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new BareIntClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new BareIntClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new BareIntClassKey(103); var oneOhFive = 105; @@ -3618,17 +3924,29 @@ async Task RunQueries(DbContext context) var two = 2; var three = new ComparableIntClassKey(3); + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(1))), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(two))), - await context.Set().Include(e => e.OptionalDependents).SingleAsync(e => e.Id.Equals(three)), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(4))) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(1))), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(two))), + await principalQuery.SingleAsync(e => e.Id.Equals(three)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableIntClassKey(4))) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = 102; var oneOhThree = new ComparableIntClassKey(103); var oneOhFive = 105; @@ -3770,18 +4088,29 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new BytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey(two))), - (await context.Set().Include(e => e.OptionalDependents).Where(e => e.Id.Equals(three)).ToListAsync()) - .Single(), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey(two))), + (await principalQuery.Where(e => e.Id.Equals(three)).ToListAsync()).Single(), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new BytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -3946,19 +4275,31 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new StructuralComparableBytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(two))), - (await context.Set().Include(e => e.OptionalDependents) - .Where(e => e.Id.Equals(three)).ToListAsync()) - .Single(), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(two))), + (await principalQuery.Where(e => e.Id.Equals(three)).ToListAsync()).Single(), + await principalQuery.SingleAsync( e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new StructuralComparableBytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -4129,19 +4470,29 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new ComparableBytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(two))), - (await context.Set().Include(e => e.OptionalDependents).Where(e => e.Id.Equals(three)) - .ToListAsync()) - .Single(), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(two))), + (await principalQuery.Where(e => e.Id.Equals(three)).ToListAsync()).Single(), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new ComparableBytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -4314,19 +4665,30 @@ async Task RunQueries(DbContext context) var two = new byte[] { 2, 2 }; var three = new GenericComparableBytesStructKey { Id = [3, 3, 3] }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.OptionalDependents); + } + principals = [ - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 1 } })), - await context.Set().Include(e => e.OptionalDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey(two))), - (await context.Set().Include(e => e.OptionalDependents) - .Where(e => e.Id.Equals(three)).ToListAsync()) - .Single(), - await context.Set().Include(e => e.OptionalDependents).SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 1 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey(two))), + (await principalQuery.Where(e => e.Id.Equals(three)).ToListAsync()).Single(), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.OptionalDependents).LoadAsync(); + } + } + var oneOhTwo = new byte[] { 102 }; var oneOhThree = new GenericComparableBytesStructKey { Id = [103] }; var oneOhFive = new byte[] { 105 }; @@ -4481,17 +4843,29 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new BytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents).SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new BytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -4658,18 +5032,29 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new ComparableBytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new ComparableBytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -4844,18 +5229,31 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new StructuralComparableBytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync( e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new StructuralComparableBytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -5033,18 +5431,31 @@ async Task RunQueries(DbContext context) var twelve = new byte[] { 12, 12 }; var thirteen = new GenericComparableBytesStructKey { Id = [13, 13, 13] }; + IQueryable principalQuery + = context.Set(); + + if (Fixture.UseInclude) + { + principalQuery = principalQuery.Include(e => e.RequiredDependents); + } + principals = [ - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = twelve })), - await context.Set().Include(e => e.RequiredDependents) - .SingleAsync(e => e.Id.Equals(thirteen)), - await context.Set().Include(e => e.RequiredDependents).SingleAsync( + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } })), + await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = twelve })), + await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), + await principalQuery.SingleAsync( e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; + if (!Fixture.UseInclude) + { + foreach (var principal in principals) + { + await context.Entry(principal).Collection(e => e.RequiredDependents).LoadAsync(); + } + } + var oneTwelve = new byte[] { 112 }; var oneThirteen = new GenericComparableBytesStructKey { Id = [113] }; var oneFifteeen = new byte[] { 115 }; @@ -6911,6 +7322,9 @@ public abstract class KeysWithConvertersFixtureBase : SharedStoreFixtureBase "KeysWithConverters"; + public virtual bool UseInclude + => true; + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { modelBuilder.Entity(