appsettings

Best practices for storing UI settings?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 11:45:35
问题 we're currently planning a larger WPF LoB application and i wonder what others think being the best practice for storing lots of UI settings e.g. Expander States Menu orders Sizing Properties etc... i don't like the idea of having dozens of stored values using the delivered SettingsProvider (i.e. App.config file) although it can be used to store it in an embedded database using a custom SettingsProvider. being able to use some kind of databinding is also a concern. Has anyone had the same

appSettings vs applicationSettings. appSettings outdated? [duplicate]

故事扮演 提交于 2019-11-27 11:25:52
This question already has an answer here: Pros and cons of AppSettings vs applicationSettings (.NET app.config / Web.config) 5 answers I've got some questions about two ways to save settings in the web.config. Appsettings : Look in web.config <appSettings> <add key="key1" value="value1"/> <add key="key2" value="value2"/> </appSettings> Usage in code-behind : ConfigurationManager.AppSettings["key1"]; ApplicationSettings/ Properties (autogenerated by using the 'properties'-tab in the project) Look in web.config <applicationSettings> <Projectname.Properties.Settings> <setting name=

Different application settings depending on configuration mode

微笑、不失礼 提交于 2019-11-27 11:18:48
问题 Is anyone aware of a way that I can set application (or user) level settings in a .Net application that are conditional on the applications current development mode? IE: Debug/Release To be more specific, I have a url reference to my webservices held in my application settings. During release mode I would like those settings to point to http://myWebservice.MyURL.com during debug mode I would love those settings to be http://myDebuggableWebService.MyURL.com. Any ideas? 回答1: I know this was

ASP.NET Core appsettings.json update in code

旧巷老猫 提交于 2019-11-27 10:36:53
问题 I am currently working on project using asp.net core v1.1, and in my appsettings.json I have: "AppSettings": { "AzureConnectionKey": "***", "AzureContainerName": "**", "NumberOfTicks": 621355968000000000, "NumberOfMiliseconds": 10000, "SelectedPvInstalationIds": [ 13, 137, 126, 121, 68, 29 ], "MaxPvPower": 160, "MaxWindPower": 5745.35 }, I also have class that I use to store them: public class AppSettings { public string AzureConnectionKey { get; set; } public string AzureContainerName { get;

How to check if an appSettings key exists?

只愿长相守 提交于 2019-11-27 10:03:35
问题 How do I check to see if an Application Setting is available? i.e. app.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key ="someKey" value="someValue"/> </appSettings> </configuration> and in the codefile if (ConfigurationManager.AppSettings.ContainsKey("someKey")) { // Do Something }else{ // Do Something Else } 回答1: MSDN: Configuration Manager.AppSettings if (ConfigurationManager.AppSettings[name] != null) { // Now do your magic.. } or string s =

how to get value from appsettings.json

半城伤御伤魂 提交于 2019-11-27 09:45:06
问题 public class Bar { public static readonly string Foo = ConfigurationManager.AppSettings["Foo"]; } In the .NET Framework 4.x, I can use the ConfigurationManager.AppSettings ["Foo"] to get Foo in Webconfig ,and then I can easily get the value of Foo through Bar.Foo But in .Net core, I mustto inject options , And can not get the value of Foo through Bar.Foo Is there a method, which can be directly through the Bar.Foo to get the value of Foo ? 回答1: So there are really two ways to go about this.

Multiple AppSettings files, is it possible?

我怕爱的太早我们不能终老 提交于 2019-11-27 05:11:30
问题 I want to create 3 AppSettings config files: Database.config Messages.config Global.config And after add in my App.config: <appSettings file="Database.config" /> <appSettings file="Messages.config" /> <appSettings file="Global.config" /> But when I try to access a key that there is in one of three files with the ConfigurationManager , I got the following error: Configuration system failed to initialize. Sections must only appear once per config file. I cannot have more than one AppSettings

Objective-C - Detect when user change the app's notifications settings

不羁的心 提交于 2019-11-27 04:32:11
I need to always know which options the user choose on the push notification settings. (The options are - alert, sound and badges) So when my app launch I call: UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; and detect what the user chose. But how can I detect if the user change the settings later during the app life time? Is there some delegate method that get called when a change occur with this settings? Greg There is no delegate. You need to query the UIApplication property enabledRemoteNotificationTypes periodically, for example in

Automatically set appsettings.json for dev and release environments in asp.net core?

蹲街弑〆低调 提交于 2019-11-27 04:13:16
问题 I've defined some values in my appsettings.json for things like database connection strings, webapi locations and the like which are different for development, staging and live environments. Is there a way to have multiple appsettings.json files (like appsettings.live.json , etc, etc) and have the asp.net app just 'know' which one to use based on the build configuration it's running? 回答1: You may use conditional compilation: public Startup(IHostingEnvironment env) { var builder = new

Reading dll.config (not app.config!) from a plugin module

一世执手 提交于 2019-11-27 04:06:05
I am writing a C# .NET 2.0 .dll that is a plug in to a Larger application . The visual studio project for my module has a app.config file which is copied to a MyProj.dll.config along side of MyProj.dll. The plan is that MyProj.dll.config will be edited after the .dll is deployed. I am trying to read my settings from that modified local file. I have tried pulling out the LocalFilesSettingsObject and changing it's application name to my .dll like this: Properties.Settings config = Properties.Settings.Default; SettingsContext context = config.Context; SettingsPropertyCollection properties =