Last active
May 12, 2018 19:34
-
-
Save jesuscampos/c758e44e8849ea5559b14a42e830eecd to your computer and use it in GitHub Desktop.
Add services
This file contains hidden or 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 void ConfigureServices(IServiceCollection services) | |
{ | |
// Se crea una nueva instacia cada vez que se solicita | |
services.AddTransient<IOperationTransient, Operation>(); | |
// Se crea una nueva instacia por petición HTTP | |
services.AddScoped<IOperationScoped, Operation>(); | |
// Se crea una única instancia para toda la aplicación | |
services.AddSingleton<IOperationSingleton, Operation>(); | |
// Añade los servicios necesarios para una aplicación web MVC en un sólo método | |
// AddMvc a su vez registra servicios para Views, Razor engine, Json formatters... | |
services.AddMvc(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment