Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(RC2) (Test only) Code cleanup (Tests) #34490

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

ajcvickers
Copy link
Contributor

Plus some test refactoring to make cleanup go smoother next time.

@ajcvickers ajcvickers requested a review from a team August 21, 2024 10:59
@ajcvickers ajcvickers changed the title Code cleanup (Tests) (RC2) (Test only) Code cleanup (Tests) Aug 21, 2024
@ajcvickers
Copy link
Contributor Author

/cc @artl93

@@ -1525,8 +1524,21 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
=> modelBuilder.Entity<Customer>(
cb =>
{
cb.HasPartitionKey(c => new { c.PartitionKey1, c.PartitionKey2, c.PartitionKey3 });
cb.HasKey(c => new { c.Id, c.PartitionKey1, c.PartitionKey2, c.PartitionKey3 });
cb.HasPartitionKey(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am sad about these (doesn't seem like they reach our line char limit) but whatever

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our rules say we always expand these. Not a fan of it either.

@@ -371,28 +371,28 @@ private static List<SinglePartitionKeyEntity> CreateSinglePartitionKeyEntities()
private static List<OnlyHierarchicalPartitionKeyEntity> CreateOnlyHierarchicalPartitionKeyEntities()
=> new()
{
new()
new OnlyHierarchicalPartitionKeyEntity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference on these would be to explicitly specify the list type (new List<OnlyHierarchyPartitionKeyEntity>() just above) and then use target-typed new in the elements - hopefully the editorconfig setting allows for that... But no need to block this PR for that.

@@ -384,7 +384,7 @@ protected override Task SeedAsync(PoolableDbContext context)
NestedOwned = new Owned2 { Prop = "7" },
NestedOwnedCollection = new List<Owned2> { new() { Prop = "71" }, new() { Prop = "72" } }
},
OwnedCollection = new List<Owned1> { new Owned1 { Prop = 71 }, new Owned1 { Prop = 72 } }
OwnedCollection = new List<Owned1> { new() { Prop = 71 }, new() { Prop = 72 } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With regards to my comment above on target-typed, this is how I think it should be - explicitly type the list, implicitly the elements in the initializer...

@ajcvickers ajcvickers force-pushed the TimeOfTheSeasonForZombies branch from bb1465d to bb1607a Compare August 21, 2024 16:17
@ajcvickers ajcvickers merged commit b8e4bcb into release/9.0 Aug 21, 2024
7 checks passed
@ajcvickers ajcvickers deleted the TimeOfTheSeasonForZombies branch August 21, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants