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