title: IServiceCollection - Dependency Injection? Available Where?
body: <p>I am learning ASP.NET core though a pluralsite video. The fellow in the video tells me I can add a "service" as a singleton or as a transient, by registering it in Startup.ConfigureServices.</p>
  
  <pre><code>public class Startup {
  
      public Startup() {
      }
  
      public IConfiguration Configuration { get; set; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
      public void ConfigureServices(IServiceCollection services) {
  
          // Register the Greeter as an IGreeter and have the ASP.NET framework register it to be available to anyone who wants an IGreeter
          // Dependency injection?
          services.AddSingleton&lt;IGreeter, Greeter&gt;();
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeter greeter) {
          if (env.IsDevelopment()) {
              app.UseDeveloperExceptionPage();
          }
  
          app.Run(async (context) =&gt; {
              var greeting = greeter.GetGreeting();
              await context.Response.WriteAsync(greeting);
          });
      }
  }
  </code></pre>
  
  <p>He wasn't very clear about who is instantiating it, what its life time is, and where it is available. Can someone fill in those details for me?</p>
  
  <p>Is this doing what I would have done with a dependency injection framework like Autofac, but ASP.NET Core has it built in? Or is this different?</p>