-
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
Dbcontext OnConfiguring method generated by scaffold command. #20526
Comments
I have found a solution for the warning issue but its inconvenient to edit all DbContext and entity classes properties to avoid warnings, every time we scaffold. It would be great If generated code fixed this issue automatically.
|
Latest daily build of EF Core Power Tools removes OnConfiguring completely (if you choose to not generate a connection string) |
@ErikEJ What about Non-nullable property warnings. Is this issue also fixed in Latest daily build? How can I install Latest daily build of EF Core Power Tools? |
I have no idea, you should probably share your project file. For the daily build, look at the readme in the Power Tools repo ( not an official Microsoft project) |
@ansarizafar Are you aware of the name= syntax for connection strings? Is this something you considered? |
@ajcvickers I have used name= syntax but still OnConfiguring method is generated by scaffold command. Is it there a way to avoid Non-nullable property is uninitialized warnings in generated code? |
@bricelam Is it required that OnConfiguring be used with the name= syntax? |
Well, we need to get the |
@ajcvickers Scaffold is also generating an empty constructor which is causing an error and If I also remove this constructor then the project builds successfully.
|
@ansarizafar Scaffolding for nullable reference types is tracked by #15520. |
Notes from team discussion:
|
Linking to #19899, which is about the name= part. |
I am using following ef command to scaffold postgres db
The scaffold command is generating ApplicationDbContext class with OnConfiguring mehod
Is it possible to tell scaffold command to stop generating OnConfiguring method. I don't need this method as I am using
in startup,cs file, Is it also possible to avoid following warnings in generated code?
The text was updated successfully, but these errors were encountered: