I am currently developping a web API, together with the related website. I was about to add in my Startup.cs my new service :
builder.Services.AddScoped<IUserService, UserService>();
But since then, I am wondering how can we know what "type" of service should we add ? There is a bunch of possibilities :
AddScoped
AddSingleton
AddTransient
AddSession
...
And I think this is possibly confusing. So how can we know what type of service makes the most sense for what we want to add (repositories, services, ...) ? What aspects should we take into consideration ?
Also, what impact does it have on our applications ? Does it change anything regarding security, performance or anything else ?
Thanks.
EDIT : here is a better question/explanation