Well, as noted in the comment on the question, there is an IDesignTimeDbContextFactory interface that needs to be implemented to resolve DbContext during development.
It might look something like this:
public static class Programm{ ... public static IWebHost BuildWebHostDuringGen(string[] args) { return WebHost.CreateDefaultBuilder(args) .UseStartup<StartupGen>()
However, due to some unclear reasons (I asked the guys from Microsoft, but they donβt explain it to me) dotnet currently implicitly calls Programm.BuildWebHost on each operation, even if it is closed, which is the reason the standard stream every time for the author of the question. A workaround for this is to Rename Programm.BuildWebHost to something else, such as InitWebHost
There is a problem created for this , so it may be resolved in version 2.1 in the future.
source share