Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Better alternative for global variables

$
0
0

In an ASP.Net Core 1.1 Web API, I need to store some global information that must be accessible across all controllers. So when the client calls a certain endpoint on the API, a certain variable (a Dictionary) must be set, which will be read from all other controllers. From what I've seen, it's apparently a bad idea to use global static variables? Could maybe someone tell me why, and what is a better alternative? I've heard about using configuration files or cache... Any recommendations? Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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