I can't figure out how to handle connection strings in EF and NetCore
I have a solution with EntityFrameworkCore 3.1.7 and two projects:
WebApp.csproj
ShraedLibrary.csproj
- appsettings.json
All data connection stuffs are in ShraedLibrary, where I have this constructors:
public DatabaseContext (DbContextOptions<DatabaseContext> options, ILoggerProvider loggerProvider)
This works fine, but I cannot Update-Database using the connection string from appsettings.json because there is no parameterless constructor.
When I hardcode the connection string inside a parameterless constructor then it works
What is the right way of doing this?
[EDIT]
Don't use -Project in Update-Database solved the problem.