Created
April 11, 2021 20:30
-
-
Save StacyGay/7bc52b7a8b5e47b31ed620292af751ed to your computer and use it in GitHub Desktop.
Unity DI VNext Startup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
// This method gets called by a runtime. Use this method to add services to the container | |
public IServiceProvider ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc(); | |
services.AddTransient<ITransientService, TransientService>(); | |
services.AddScoped<IScopedService, ScopedService>(); | |
services.AddSingleton<ISingletonService, SingletonService>(); | |
} | |
// Configure is called after ConfigureServices is called. | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
// Configure the HTTP request pipeline. | |
app.UseStaticFiles(); | |
// Add MVC to the request pipeline. | |
app.UseMvc(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment