asp.net core services.AddDbContext code example
Example: c# services.adddbcontext
public void ConfigureServices(IServiceCollection services)
{
var connectionString = "connection string to database";
services.AddDbContext<MyContext>(ServiceLifetime.Scoped);
}