I am using ASP.NET Core with EF Core Code First. I am defining the dependency injection of the DbContext in service configuration of the Startup.cs of my ASP.NET Core project like described here (https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html):
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<TestContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DevelopmentDatabase")));
}
But I do not want to use the DbContext in a controller like described at the same site but I want to outsource it to another .NET Core Class Library project together with the Migration.
How do I accomplish this?