aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

As I am configuring things I am wondering where I should store variables in server side blazor project

Open jvelezc opened this issue 8 years ago • 4 comments

Could you provide guidance on how to store variables.

For example: I ended up putting a appsettings.json on the client side project and using IConfiguration and then just doing


   public class Startup
    {

        public IConfiguration Configuration { get; }
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

At startup.cs. But should I have put this on Server project. Should there be a "blazor way" to store configs?

jvelezc avatar Sep 21 '18 03:09 jvelezc

The way I do it at the moment is through embedding the config to the ClientApp.dll using MSBuild. See aspnet/Blazor#1152 for how I do the embedding and also how others have are doing it at the moment.

RyoukoKonpaku avatar Sep 21 '18 07:09 RyoukoKonpaku

@jvelezc What you're doing is totally fine. ASP.NET Core's configuration system lets you combine config sources from multiple locations, so if you want to have some config files in your Blazor app project, that's the way to go.

@RyoukoKonpaku I think @jvelezc is asking about server-side apps, so embedding the resource isn't required.

SteveSandersonMS avatar Sep 21 '18 11:09 SteveSandersonMS

Ah I see then yes it's not required since it's essentially a normal netcore app.

RyoukoKonpaku avatar Sep 21 '18 14:09 RyoukoKonpaku

Thanks!

jvelezc avatar Sep 22 '18 03:09 jvelezc