Dotnetcore webpi dependencies injection
Think this is something i have forgotten over and over again, doing dependencies injection in Dotnet core webapi service.
All i have to to do look for this method and add whatever services that i'm going to be using :-
public void ConfigureServices(IServiceCollection services) { services.Configure
}
What's the deal with
a) AddSingleton -> Create a single instance of object to be shared across session. The controller or services use same instance.
b) AddScoped -> Pass the same object if it is the same session
c) AddTransient -> Different object created and pass into controller and services
Comments