The lifetime is a parameter on AddDbContext<>(). See example:
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")),
ServiceLifetime.Transient);
This will add it to the service collection with transient lifetime.