Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to read appsetting.json from any class blazor serverside

$
0
0

i know how to acess to appsetting.json fron razor component but how from any class in a blazor serverside project?

from razor component i simply inject:

@inject IConfiguration _config

and access all that i need like :_config.GetConnectionString("default")

but how can do the same from any class?when i try to do

IConfiguration _config;

it says when i want to reach data that _config is null or is an unassigned local variable depands where i write the variable.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>