Skip to content

Commit

Permalink
Query: Fix temporal table tests
Browse files Browse the repository at this point in the history
Resolves #26047
  • Loading branch information
smitpatel committed Sep 16, 2021
1 parent d658a35 commit b58a57f
Show file tree
Hide file tree
Showing 13 changed files with 545 additions and 619 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,12 @@ protected virtual void RecordLog()
public abstract class ManyToManyFieldsLoadFixtureBase : ManyToManyFieldsQueryFixtureBase
{
protected override string StoreName { get; } = "ManyToManyFieldsLoadTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder).ConfigureWarnings(
c => c
.Log(CoreEventId.ShadowForeignKeyPropertyCreated))
.EnableDetailedErrors();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
.WithOne(e => e.ReferenceInverse)
.HasForeignKey<EntityTwo>(e => e.ReferenceInverseId);

// TODO: Remove UsingEntity
modelBuilder.Entity<EntityOne>()
.HasMany(e => e.TwoSkipShared)
.WithMany(e => e.OneSkipShared)
.UsingEntity<Dictionary<string, object>>(
"EntityOneEntityTwo",
r => r.HasOne<EntityTwo>().WithMany().HasForeignKey("EntityTwoId"),
l => l.HasOne<EntityOne>().WithMany().HasForeignKey("EntityOneId"));
.WithMany(e => e.OneSkipShared);

// Nav:2 Payload:No Join:Concrete Extra:None
modelBuilder.Entity<EntityOne>()
.HasMany(e => e.TwoSkip)
.WithMany(e => e.OneSkip)
// See issue#25491
.UsingEntity<JoinOneToTwo>(
r => r.HasOne<EntityTwo>().WithMany().HasForeignKey(e => e.TwoId),
l => l.HasOne<EntityOne>().WithMany().HasForeignKey(e => e.OneId));
Expand Down Expand Up @@ -325,9 +321,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
modelBuilder.Entity<EntityOne>()
.HasMany(e => e.BranchSkip)
.WithMany(e => e.OneSkip)
.UsingEntity<JoinOneToBranch>(
r => r.HasOne<EntityBranch>().WithMany(),
l => l.HasOne<EntityOne>().WithMany());
.UsingEntity<JoinOneToBranch>();

modelBuilder.Entity<EntityTwo>()
.HasOne(e => e.Reference)
Expand All @@ -348,25 +342,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
l => l.HasOne(x => x.Two).WithMany(e => e.JoinThreeFull));

// Nav:2 Payload:No Join:Shared Extra:Self-ref
// TODO: Remove UsingEntity
modelBuilder.Entity<EntityTwo>()
.HasMany(e => e.SelfSkipSharedLeft)
.WithMany(e => e.SelfSkipSharedRight)
.UsingEntity<Dictionary<string, object>>(
"JoinTwoSelfShared",
l => l.HasOne<EntityTwo>().WithMany().HasForeignKey("LeftId"),
r => r.HasOne<EntityTwo>().WithMany().HasForeignKey("RightId"));
.WithMany(e => e.SelfSkipSharedRight);

// Nav:2 Payload:No Join:Shared Extra:CompositeKey
// TODO: Remove UsingEntity
modelBuilder.Entity<EntityTwo>()
.HasMany(e => e.CompositeKeySkipShared)
.WithMany(e => e.TwoSkipShared)
.UsingEntity<Dictionary<string, object>>(
"JoinTwoToCompositeKeyShared",
r => r.HasOne<EntityCompositeKey>().WithMany().HasForeignKey("CompositeId1", "CompositeId2", "CompositeId3"),
l => l.HasOne<EntityTwo>().WithMany().HasForeignKey("TwoId"))
.HasKey("TwoId", "CompositeId1", "CompositeId2", "CompositeId3");
.WithMany(e => e.TwoSkipShared);

// Nav:6 Payload:No Join:Concrete Extra:CompositeKey
modelBuilder.Entity<EntityThree>()
Expand All @@ -388,23 +371,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
});

// Nav:2 Payload:No Join:Shared Extra:Inheritance
// TODO: Remove UsingEntity
modelBuilder.Entity<EntityThree>().HasMany(e => e.RootSkipShared).WithMany(e => e.ThreeSkipShared)
.UsingEntity<Dictionary<string, object>>(
"EntityRootEntityThree",
r => r.HasOne<EntityRoot>().WithMany().HasForeignKey("EntityRootId"),
l => l.HasOne<EntityThree>().WithMany().HasForeignKey("EntityThreeId"));
modelBuilder.Entity<EntityThree>().HasMany(e => e.RootSkipShared).WithMany(e => e.ThreeSkipShared);

// Nav:2 Payload:No Join:Shared Extra:Inheritance,CompositeKey
// TODO: Remove UsingEntity
modelBuilder.Entity<EntityCompositeKey>()
.HasMany(e => e.RootSkipShared)
.WithMany(e => e.CompositeKeySkipShared)
.UsingEntity<Dictionary<string, object>>(
"JoinCompositeKeyToRootShared",
r => r.HasOne<EntityRoot>().WithMany().HasForeignKey("RootId"),
l => l.HasOne<EntityCompositeKey>().WithMany().HasForeignKey("CompositeId1", "CompositeId2", "CompositeId3"))
.HasKey("CompositeId1", "CompositeId2", "CompositeId3", "RootId");
.WithMany(e => e.CompositeKeySkipShared);

// Nav:6 Payload:No Join:Concrete Extra:Inheritance,CompositeKey
modelBuilder.Entity<EntityCompositeKey>()
Expand All @@ -418,15 +390,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
e.CompositeId1,
e.CompositeId2,
e.CompositeId3
}))
.HasKey(
e => new
{
e.CompositeId1,
e.CompositeId2,
e.CompositeId3,
e.LeafId
});
}));

modelBuilder.SharedTypeEntity<ProxyableSharedType>(
"PST", b =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,22 +188,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
.WithOne(e => e.ReferenceInverse)
.HasForeignKey<EntityTwo>(e => e.ReferenceInverseId);

// TODO: Remove UsingEntity
modelBuilder.Entity<EntityOne>()
.HasMany(e => e.TwoSkipShared)
.WithMany(e => e.OneSkipShared)
.UsingEntity<Dictionary<string, object>>(
"EntityOneEntityTwo",
r => r.HasOne<EntityTwo>().WithMany().HasForeignKey("EntityTwoId"),
l => l.HasOne<EntityOne>().WithMany().HasForeignKey("EntityOneId"));
.WithMany(e => e.OneSkipShared);

// Nav:2 Payload:No Join:Concrete Extra:None
modelBuilder.Entity<EntityOne>()
.HasMany(e => e.TwoSkip)
.WithMany(e => e.OneSkip)
.UsingEntity<JoinOneToTwo>(
r => r.HasOne(e => e.Two).WithMany().HasForeignKey(e => e.TwoId),
l => l.HasOne(e => e.One).WithMany().HasForeignKey(e => e.OneId));
.UsingEntity<JoinOneToTwo>();

// Nav:6 Payload:Yes Join:Concrete Extra:None
modelBuilder.Entity<EntityOne>()
Expand Down Expand Up @@ -235,9 +228,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
modelBuilder.Entity<EntityOne>()
.HasMany(e => e.BranchSkip)
.WithMany(e => e.OneSkip)
.UsingEntity<JoinOneToBranch>(
r => r.HasOne<EntityBranch>().WithMany(),
l => l.HasOne<EntityOne>().WithMany());
.UsingEntity<JoinOneToBranch>();

modelBuilder.Entity<EntityTwo>()
.HasOne(e => e.Reference)
Expand Down Expand Up @@ -303,15 +294,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
e.CompositeId1,
e.CompositeId2,
e.CompositeId3
}))
.HasKey(
e => new
{
e.CompositeId1,
e.CompositeId2,
e.CompositeId3,
e.LeafId
});
}));

modelBuilder.SharedTypeEntity<ProxyableSharedType>(
"PST", b =>
Expand Down
Loading

0 comments on commit b58a57f

Please sign in to comment.