-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce complete discriminator mapping
- Add fluent API IsComplete over DiscriminatorBuilder - In query if mapping is complete - Don't generate predicate when creating Select for an entityType - Don't apply predicate when doing OfType of derived type when the discriminator is not needed Current default: Mapping is incomplete unless user uses fluent API to mark it as complete. Resolves #18106
- Loading branch information
Showing
22 changed files
with
795 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
test/EFCore.InMemory.FunctionalTests/Query/CompleteMappingInheritanceInMemoryFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class CompleteMappingInheritanceInMemoryFixture : InheritanceInMemoryFixture | ||
{ | ||
protected override bool IsDiscriminatorMappingComplete => true; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
test/EFCore.InMemory.FunctionalTests/Query/CompleteMappingInheritanceInMemoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Microsoft.EntityFrameworkCore.Diagnostics; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class CompleteMappingInheritanceInMemoryTest : InheritanceTestBase<CompleteMappingInheritanceInMemoryFixture> | ||
{ | ||
public CompleteMappingInheritanceInMemoryTest(CompleteMappingInheritanceInMemoryFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
[ConditionalFact] | ||
public override void Can_query_all_animal_views() | ||
{ | ||
var message = Assert.Throws<InvalidOperationException>(() => base.Can_query_all_animal_views()).Message; | ||
|
||
Assert.Equal( | ||
CoreStrings.TranslationFailed( | ||
@"DbSet<Bird>() | ||
.Select(b => InheritanceInMemoryFixture.MaterializeView(b)) | ||
.OrderBy(a => a.CountryId)"), | ||
message); | ||
} | ||
|
||
protected override bool EnforcesFkConstraints => false; | ||
} | ||
} |
Oops, something went wrong.