title: AddTransient, AddScoped and AddSingleton Services Differences
body: <p>I want to implement <a href="https://en.wikipedia.org/wiki/Dependency_injection" rel="noreferrer">dependency injection</a> (DI) in ASP.NET Core. So after adding this code to <strong><code>ConfigureServices</code></strong> method, both ways work.</p>
  <p>What is the difference between the <code>services.AddTransient</code> and <code>service.AddScoped</code> methods in ASP.NET Core?</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      // Add framework services.
  
      // Add application services.
      services.AddTransient&lt;IEmailSender, AuthMessageSender&gt;();
      services.AddScoped&lt;IEmailSender, AuthMessageSender&gt;();
  }
  </code></pre>