top of page

Adding a service - Core MVC

There are 3 types of services to add in the ConfigureServices of the Startup.cs file

  1. AddTransient - usually just a method that does something

  2. AddScoped - usually a little more expensive to create

  3. 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