-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for EF Core table-per-concrete-type inheritance mode
https://learn.microsoft.com/en-us/ef/core/modeling/inheritance#table-per-concrete-type-configuration
- Loading branch information
Showing
6 changed files
with
96 additions
and
24 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
33 changes: 33 additions & 0 deletions
33
...ntegrationTests/ResourceInheritance/TablePerConcreteType/TablePerConcreteTypeDbContext.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,33 @@ | ||
using JetBrains.Annotations; | ||
using JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
// @formatter:wrap_chained_method_calls chop_always | ||
|
||
namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.TablePerConcreteType; | ||
|
||
[UsedImplicitly(ImplicitUseTargetFlags.Members)] | ||
public sealed class TablePerConcreteTypeDbContext : ResourceInheritanceDbContext | ||
{ | ||
public TablePerConcreteTypeDbContext(DbContextOptions<TablePerConcreteTypeDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder builder) | ||
{ | ||
builder.Entity<Vehicle>() | ||
.UseTpcMappingStrategy(); | ||
|
||
builder.Entity<Wheel>() | ||
.UseTpcMappingStrategy(); | ||
|
||
builder.Entity<Engine>() | ||
.UseTpcMappingStrategy(); | ||
|
||
builder.Entity<GenericProperty>() | ||
.UseTpcMappingStrategy(); | ||
|
||
base.OnModelCreating(builder); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ntegrationTests/ResourceInheritance/TablePerConcreteType/TablePerConcreteTypeReadTests.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,13 @@ | ||
using JetBrains.Annotations; | ||
using TestBuildingBlocks; | ||
|
||
namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.TablePerConcreteType; | ||
|
||
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] | ||
public sealed class TablePerConcreteTypeReadTests : ResourceInheritanceReadTests<TablePerConcreteTypeDbContext> | ||
{ | ||
public TablePerConcreteTypeReadTests(IntegrationTestContext<TestableStartup<TablePerConcreteTypeDbContext>, TablePerConcreteTypeDbContext> testContext) | ||
: base(testContext) | ||
{ | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...tegrationTests/ResourceInheritance/TablePerConcreteType/TablePerConcreteTypeWriteTests.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,13 @@ | ||
using JetBrains.Annotations; | ||
using TestBuildingBlocks; | ||
|
||
namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.TablePerConcreteType; | ||
|
||
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] | ||
public sealed class TablePerConcreteTypeWriteTests : ResourceInheritanceWriteTests<TablePerConcreteTypeDbContext> | ||
{ | ||
public TablePerConcreteTypeWriteTests(IntegrationTestContext<TestableStartup<TablePerConcreteTypeDbContext>, TablePerConcreteTypeDbContext> testContext) | ||
: base(testContext) | ||
{ | ||
} | ||
} |
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