You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for the long title. Basically I'm having a problem when two tables have the same name but different schema (using Microsoft.EntityFrameworkCore.SqlServer) when those tables have a relationship between them.
As you can see, for the Bar entity (which now points to the table SchemaForBar.Foo), it added all the columns for the properties in Foo (including two completely unrelated string and int properties).
Again, this only happens if both tables are named the same (although in a different schema) -and- if they have a one-to-one relationship (I haven't tested with other relationships)
I've just tried this with EF Core 3.0.0-preview9.19423.6 (latest available on general nuget)
The workaround is easy enough: just don't call the tables the same, however I believe this should be looked upon, because other bugs may arise in this case: looks to me that "something" at some point on the migration builder is not taking the schema into account for the "uniqueness" of the Entity -> Table conversion and just checking a name
The text was updated successfully, but these errors were encountered:
Sorry for the long title. Basically I'm having a problem when two tables have the same name but different schema (using Microsoft.EntityFrameworkCore.SqlServer) when those tables have a relationship between them.
Say this extremely simple case:
This works fine with this model configuration:
The migration is correct and I get a 1:1 relationship FK constraint so that both
Foo
andBar
have to use the sameId
. This is correct and what I want.However if I change this:
to this, so both tables for
Foo
andBar
, have the same name, but different schema:And I add a migration, I end up with this:
As you can see, for the
Bar
entity (which now points to the tableSchemaForBar.Foo
), it added all the columns for the properties inFoo
(including two completely unrelatedstring
andint
properties).Again, this only happens if both tables are named the same (although in a different schema) -and- if they have a one-to-one relationship (I haven't tested with other relationships)
I've just tried this with EF Core 3.0.0-preview9.19423.6 (latest available on general nuget)
The workaround is easy enough: just don't call the tables the same, however I believe this should be looked upon, because other bugs may arise in this case: looks to me that "something" at some point on the migration builder is not taking the schema into account for the "uniqueness" of the
Entity -> Table
conversion and just checking a nameThe text was updated successfully, but these errors were encountered: