What is the difference between
AddSingleton
, AddScoped
, and AddTransient
?AddSingleton
: Creates a single instance for the entire application lifecycle.AddScoped
: Creates a new instance for each HTTP request.AddTransient
Creates a new instance every time it is requested.