Skip to content

Commit 4bdd787

Browse files
Replace explicit table name overrides with SimpleTableNames helper to simplify model configuration.
1 parent b9f21ed commit 4bdd787

File tree

1 file changed

+2
-57
lines changed

1 file changed

+2
-57
lines changed

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsFbFixture.cs

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
//$Authors = Niek Schoemaker (@niekschoemaker)
1717

18+
using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.Helpers;
1819
using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestUtilities;
1920
using Microsoft.EntityFrameworkCore;
20-
using Microsoft.EntityFrameworkCore.Query.Associations;
2121
using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations;
2222
using Microsoft.EntityFrameworkCore.TestUtilities;
2323

@@ -32,61 +32,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
3232
{
3333
base.OnModelCreating(modelBuilder, context);
3434

35-
// This directly overrides the Table names from OwnedNavigationsRelationalFixtureBase
36-
// This is needed as it otherwise exceeds the column length of Firebird 3 & 4.
37-
modelBuilder.Entity<RootEntity>(b =>
38-
{
39-
b.OwnsOne(
40-
e => e.RequiredAssociate, rrb =>
41-
{
42-
rrb.OwnsMany(
43-
r => r.NestedCollection, rcb =>
44-
{
45-
rcb.ToTable("RR_NC"); // RequiredRelated_NestedCollection
46-
});
47-
});
48-
49-
b.OwnsOne(
50-
e => e.OptionalAssociate, orb =>
51-
{
52-
orb.OwnsMany(
53-
r => r.NestedCollection, rcb =>
54-
{
55-
rcb.ToTable("OR_NC"); // OptionalRelated_NestedCollection
56-
});
57-
});
58-
59-
b.OwnsMany(
60-
e => e.AssociateCollection, rcb =>
61-
{
62-
rcb.OwnsMany(
63-
r => r.NestedCollection, rcb =>
64-
{
65-
rcb.ToTable("RC_NC"); // RelatedCollection_NestedCollection
66-
});
67-
});
68-
69-
70-
b.OwnsOne(
71-
e => e.RequiredAssociate, rrb =>
72-
{
73-
rrb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.ToTable("RR_RN")); // RequiredRelated_RequiredNested
74-
rrb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.ToTable("RR_ON")); // RequiredRelated_OptionalNested
75-
});
76-
77-
b.OwnsOne(
78-
e => e.OptionalAssociate, rrb =>
79-
{
80-
rrb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.ToTable("OR_RN")); // OptionalRelated_RequiredNested
81-
rrb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.ToTable("OR_ON")); // OptionalRelated_OptionalNested
82-
});
83-
84-
b.OwnsMany(
85-
e => e.AssociateCollection, rcb =>
86-
{
87-
rcb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.ToTable("RC_RN")); // RelatedCollection_RequiredNested
88-
rcb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.ToTable("RC_ON")); // RelatedCollection_OptionalNested
89-
});
90-
});
35+
ModelHelpers.SimpleTableNames(modelBuilder);
9136
}
9237
}

0 commit comments

Comments
 (0)