C
C#2y ago
Alizer

❔ Any good persistent data solution for .net core 6 c#?

Back in .NET framework I use settings and the Properties.Settings.Default namespace to store data in just about a line of code but looks like I cannot use it with the new .net core 6, is there like a library or just a good way of storing persistent user data in .net core? something that doesnt require me to use a database
8 Replies
ero
ero2y ago
A custom settings class comes to mind Serialize it to json when the app closes (or any time you feel like) and save the file to some directory (%(LOCAL)APPDATA%/MyApp), and deserialize it when your app starts
Alizer
Alizer2y ago
alright, sigh i guess i have to write it my own
ero
ero2y ago
Pretty sure the way you describe is only a WinForms thing?
Alizer
Alizer2y ago
System.Configuration.ConfigurationManager looks like a .net framework thing, and wont work on .net core but my app runs in avalonia and is targeted to ubuntu desktop
ero
ero2y ago
Yeah if it's a Windows-only thing it won't work for you
ChucklesTheBeard
there's https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration for config/user settings, but it's readonly
Configuration - .NET
Learn how to use the Configuration API to configure .NET applications.
sibber
sibber2y ago
theres a winrt api for packaged apps otherwise youd have to write your own afaik
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.