2023-04-21

Blazor access value from program.cs from a component [duplicate]

I have a Blazor Server Side application.

In the program.cs I have a check if the application is running in development, production or staging.

if (builder.Environment.IsDevelopment())
{
    Console.WriteLine("##### Running in Development ####");
}
if (builder.Environment.IsProduction())
{
    Console.WriteLine("##### Running in Production ####");
}
if (builder.Environment.IsStaging())
{
    Console.WriteLine("##### Running in Staging ####");
}

I want to display this in my MainLayout.razor.

How would I approach this? Can I parse this somehow or can I access the builder somehow through a service?



No comments:

Post a Comment