Home > Blockchain >  Blazor - Merge .json file to IConfiguration
Blazor - Merge .json file to IConfiguration

Time:02-25

So in Blazor you get an instance implementing IConfiguration as default service. No need to register it yourself. My Question is: Can I load additional .json files into the default IConfiguration instance? And if not, is it possible to register my own IConfiguration and load different .json files into it? And if so, how?

CodePudding user response:

There's some useful documentation here:

Yes, you can load additional files like this:

(assuming that var stream is a stream from a Json configuration file).

builder.Configuration.AddJsonStream(stream);
  • Related