Add comments about Singleton, Scoped and Transient to Program.cs file.
This commit is contained in:
parent
9e7e7df370
commit
b9d6b79ad4
@ -7,6 +7,11 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
builder.Services.AddRazorComponents()
|
builder.Services.AddRazorComponents()
|
||||||
.AddInteractiveServerComponents(); // Provides server interactivity.
|
.AddInteractiveServerComponents(); // Provides server interactivity.
|
||||||
|
|
||||||
|
// Singleton - A single instance is created and shared troughout the application's lifetime.
|
||||||
|
// Scoped - A new instance is created for each request.
|
||||||
|
// Transient - A new instance is created every time it is needed.
|
||||||
|
// See: https://www.youtube.com/watch?v=V-8HlozCTOU
|
||||||
|
|
||||||
builder.Services.AddTransient<SessionStorage>();
|
builder.Services.AddTransient<SessionStorage>();
|
||||||
|
|
||||||
// Scoped lifespan is the same as the SignalR lifespan.
|
// Scoped lifespan is the same as the SignalR lifespan.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user