1
0

Add comments about Singleton, Scoped and Transient to Program.cs file.

This commit is contained in:
Kevin Matsubara 2025-03-31 23:46:37 +02:00
parent 9e7e7df370
commit b9d6b79ad4

View File

@ -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.