What is the best way to store a setup state that influences the showen data on a page?

Posted 95 days ago by nogood


I have a Blazor Server App. At one page "setuppage" the admin can choose what pricelist is the one pricelist that should be used in the app. For this blazor gets/reads in a list of lists from a mongoDB. The admin chooses in  a Listbox the one to use. Okay but how do I save this choice for later uses? Singelten Service is not working because my WebspaceServerProvider resets my App every 30 min so I cant save the chosen list on memory. Do I just save that choice in a .txt-file on the blazor app server and load that one "choice string" on App startup (load the appropriet mongoDBlist becaue of that .txt) and put it in a singeltonService in startup.cs. That would be okay because on every new startup the singelton would be reloaded with the right pricelist. What is the best way to store this kind of a setup stuff in a blazor app?

  • 0

    Why not just save the selected item Id or value to a database table, then check that table throughout your app to see if an admin has set a default value?

    Posted 91 days ago by selliott
  • 0

    I just wanted to know if that is the best way. In Winforms etc. I would use mysettigns. Didn't know if DB query is fast enought

    Posted 87 days ago by nogood
  • 0

    You could also implement some caching to reduce database calls and improve performance, but remember to reset it if the admin changes the value.

    If the value is never (or rarely) going to change after the site is launched, it could also just be added to appsettings.json by a developer before the app is deployed.

    Posted 86 days ago by selliott Edited 86 days ago
Someone is typing...

Post a Reply

You must be logged in to add a new post.
Number of online users: 0
An error has occurred. This application may no longer respond until reloaded. Reload 🗙