top of page
Adding a service - Core MVC
There are 3 types of services to add in the ConfigureServices of the Startup.cs file
-
AddTransient - usually just a method that does something
-
AddScoped - usually a little more expensive to create
-
AddSingleton - usually created once and kept for the lifetime of the server being up
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IMailService, NullMailService>();
services.AddControllersWithViews();
}
bottom of page