-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Further merge query types into entity types #17101
Conversation
Stubbing out parts of #14537 as an implementation detail. |
}; | ||
var table = type == "table" | ||
? new DatabaseTable() | ||
: new DatabaseView(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @ErikEJ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 😎
test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs
Outdated
Show resolved
Hide resolved
As per #17044 (review) We should consider changing the condition in |
@AndriySvyryd fixed that, and the duplicate table name validation |
@@ -30,7 +30,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con | |||
modelBuilder.Entity<Lilt>().Property(e => e.SugarGrams).HasColumnName("SugarGrams"); | |||
modelBuilder.Entity<Tea>().Property(e => e.CaffeineGrams).HasColumnName("CaffeineGrams"); | |||
|
|||
modelBuilder.Entity<AnimalQuery>().HasNoKey().ToTable("Animal"); | |||
modelBuilder.Entity<AnimalQuery>().HasNoKey().ToQuery( | |||
() => context.Set<AnimalQuery>().FromSqlRaw("SELECT * FROM Animal")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(We now include keyless entity types when validating that two unrelated entity types don't map to the same table.)
Changes: - Un-obsolete ToView - Differentiate between views and keyless tables in RevEng - Ignore ToView and ToQuery in Migrations; handle HasNoKey - Handle duplicate table names when HasNoKey
Changes:
Resolves #14787, fixes #14195