Skip to content
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

Merged
merged 1 commit into from
Aug 13, 2019
Merged

Further merge query types into entity types #17101

merged 1 commit into from
Aug 13, 2019

Conversation

bricelam
Copy link
Contributor

@bricelam bricelam commented Aug 12, 2019

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

Resolves #14787, fixes #14195

@bricelam bricelam requested a review from AndriySvyryd August 12, 2019 19:09
@bricelam
Copy link
Contributor Author

Stubbing out parts of #14537 as an implementation detail.

};
var table = type == "table"
? new DatabaseTable()
: new DatabaseView();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @ErikEJ

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😎

@AndriySvyryd
Copy link
Member

As per #17044 (review) We should consider changing the condition in TryUniquifyTableNames to only skip entities mapped to views.

@bricelam
Copy link
Contributor Author

@AndriySvyryd fixed that, and the duplicate table name validation

@AndriySvyryd
Copy link
Member

:shipit:

@@ -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"));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maumar FYI, I had to switch some tests to this pattern and skip them until #16323 is implemented.

Copy link
Contributor Author

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
@bricelam bricelam merged commit 8bfd1da into dotnet:release/3.0 Aug 13, 2019
@bricelam bricelam deleted the vista branch August 13, 2019 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants