-
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
3.0 Upgrade - Entity with HasNoKey() (formerly a query type) tries to create tables when adding migration #18116
Comments
I am seeing this behavior again with 5.0, ToView(null) is my workaround for now.
|
Experiencing a similar issue. I've used .HasNoKey().ToView(null) in order to avoid a table creation. Since version 5.0 it now generates a migration with a drop table even if there does not exist one! |
Call |
For some reason I don't know, using the [Keyless] Attribute instead on HasNotKey solved the problem for me |
@AndriySvyryd : I'm using EF Core 6. ToTable(null) results in
I tried .ToTable(null, t => t.ExcludeFromMigrations()) |
@KillerBoogie Use the view name it was mapped to before: |
I have the following Entity which used to be a query type:
As a query type it caused no issues, but now that it's an entity, migrations are trying to create tables for it.
I have several entities defined like so, none of which attempt table generation when adding a migration. I assume it's because of the ToView():
The problem is that my above entity types come out of a stored procedure. It's not a View or a Table.
I don't want to have to manually modify every migration going forward to account for this. Is there a way to prevent table generation when creating migrations?
Further technical details
EF Core version: 3.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.3
The text was updated successfully, but these errors were encountered: