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

DB scaffold CLI Removes DBSET<t> (dbquery<t>) #18944

Closed
loganmarshall1 opened this issue Nov 16, 2019 · 5 comments
Closed

DB scaffold CLI Removes DBSET<t> (dbquery<t>) #18944

loganmarshall1 opened this issue Nov 16, 2019 · 5 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@loganmarshall1
Copy link

Since the Dbscaffold CLI replaces dbcontext c# file each time. In order to use ef cores new dbSet (the new dbquery) you have to put into this (auto wiped out by the CLI) dbcontext file as a.HasNoKey() item.

In efc2 the dbquery we kept it in a partial class so it wouldn't get over written by the scaffold. Since we can't put dbSets in a different c# file because we need to add hasnoKey() in onmodelbuilding event (which gets over written by the scaffold), we have to stay on 2.0

Would really like to upgrade to EF core 3.0 but since they deprecated DBquery into something new that breaks db scaffolding for us we can't.

The only nuGet we haven’t updated in our core3.0 build is this efcore3.0 one. 😅

EF Core version: 3.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET Core 3.0
Operating system: win10 x64
IDE: Visual Studio 2019 16.3.8

@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 16, 2019

You are a bit unclear, but with EF Core 3, you can override the OnModelCreatingPartial partial method

@loganmarshall1
Copy link
Author

loganmarshall1 commented Nov 16, 2019 via email

@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 16, 2019

Have a close look at the last lines of the generated DbContext

@loganmarshall1
Copy link
Author

loganmarshall1 commented Nov 16, 2019 via email

@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 17, 2019

Something like this: ErikEJ/EFCorePowerTools#300 (comment)

@ajcvickers ajcvickers added closed-no-further-action The issue is closed and no further action is planned. and removed type-bug labels Nov 18, 2019
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants