application-settings

How to store a list of objects in application settings

杀马特。学长 韩版系。学妹 提交于 2019-11-27 12:11:19
I have recently became familiar with C# application settings, and it seems cool. I was searching for a way to store a list of custom objects, but I couldn't find a way! Actually I saw a post to store int[] , but it wasn't helpful for this problem. I tried to change the config of that solution in order to make it suitable for my problem. the XML config file of that was: <Setting Name="SomeTestSetting" Type="System.Int32[]" Scope="User"> <Value Profile="(Default)" /> </Setting> I tried to address my object as quoted below in the type attribute but it wasn't helpful since it doesn't recognizing

Can a spring boot @RestController be enabled/disabled using properties?

老子叫甜甜 提交于 2019-11-27 07:33:16
Given a "standard" spring boot application with a @RestController , eg @RestController @RequestMapping(value = "foo", produces = "application/json;charset=UTF-8") public class MyController { @RequestMapping(value = "bar") public ResponseEntity<String> bar( return new ResponseEntity<>("Hello world", HttpStatus.OK); } } Is there an annotation or technique that prevents the endpoint from starting at all if/unless a certain application property exists/doesn't exist. Note: Testing a property inside the method and exploding is not a solution, because the endpoint will exist. I don't care about the

Azure connection string best practices

∥☆過路亽.° 提交于 2019-11-27 06:19:10
I have an application that I am just migrating to Azure. Currently I use web.config transformation to manage changing the database connecting string dev/staging/prod environments. How is it best to manage these multiple connection strings in Azure? Jonathan McIntire In cases where it doesn't matter if the developer can see production credentials, you can use the built-in Visual Studio 10 config transformations. If this is what you're looking for, follow these steps: 1.Navigate to your Azure project folder in file explorer 2. Make a copy of ServiceConfiguration.cscfg 3. Rename copy to

Which design patterns can be applied to the configuration settings problem?

£可爱£侵袭症+ 提交于 2019-11-27 06:03:45
In large and complex software products managing configurable settings becomes a major pain. Two approaches I've seen to the problem are: have each component in the system load its own configuration from config files or registry settings. have a settings loader class that loads all the configurable system settings and have each component query the settings loader for its settings. These approaches both feel wrong to me. Are there any design patterns that could be used to simplify the problem? Maybe something that would take advantage of the dependency injection technique. I prefer to create an

Where to store Application Data in Windows 7 and Vista

ⅰ亾dé卋堺 提交于 2019-11-27 05:55:56
问题 My application needs to, like most, store data. The application was previously used on XP only where it would store the data in Program Files . Now that our customers are moving to Windows 7 I had to upgrade it so that it stored the data in a new folder. I opted for the ApplicationData folder as I thought I would be allowed access without needing UAC at all. Now on some Windows 7 machines this is fine, but on others access to the folder fails, presumably because of permissions, but when ran

How can I display the application version revision in my application's settings bundle?

落爺英雄遲暮 提交于 2019-11-27 02:26:12
I would like to include the application version and internal revision, something like 1.0.1 (r1243), in my application's settings bundle. The Root.plist file contains a fragment like this... <dict> <key>Type</key> <string>PSTitleValueSpecifier</string> <key>Title</key> <string>Version</string> <key>Key</key> <string>version_preference</string> <key>DefaultValue</key> <string>VersionValue</string> <key>Values</key> <array> <string>VersionValue</string> </array> <key>Titles</key> <array> <string>VersionValue</string> </array> </dict> and I would like to replace the "VersionValue" string at build

Difference between 'SpecialFolder.LocalApplicationData' and 'SpecialFolder.ApplicationData'?

為{幸葍}努か 提交于 2019-11-27 00:42:56
问题 On my system, %AppData% leads to ApplicationData which is C:\Users\<USER>\AppData\Roaming But there is also C:\Users\<USER>\AppData\Local And for some more confusion D:\Users\<USER>\AppData\LocalLow string local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string roaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); My question is, to which of these locations should my application save its data? Are there guidelines for which of these

Why are my application settings not getting persisted?

旧时模样 提交于 2019-11-26 21:47:51
问题 So I have some settings that are of the user scope, but for some reason, they are not being saved to the .exe.config file. I do the following: Properties.Settings.Default.Email = "new@value.com"; Properties.Settings.Default.Save(); Yet I look at the settings file in the debug folder and it is still the default that I set in visual studio. Am I doing this wrong? 回答1: User settings are specific to the user, so they wouldn't get saved back to the .exe.config file, which is system wide. From the

Accessing another project's settings file

旧巷老猫 提交于 2019-11-26 20:47:29
问题 Is there a way to access the settings file from a different project? For example, I have a solution that contains 2 projects (Lets call them Proj1 and Proj2). I want to access the application settings of Proj2 from Program.cs in Proj1. Is this possible? 回答1: Option A : parse the values out of the other assembly's configuration file (where the settings are stored) Option B : create a public class in Proj2 that exposes the necessary values from its settings as static properties, then reference

Automatically “upgrade” user settings from previous version of app.config file?

半城伤御伤魂 提交于 2019-11-26 19:51:15
问题 Every time I compile my app and the version number changes (I have an auto-incrementing build number), I lose the user-configured app.config settings, since they're stored in the AppData folder for a specific version. Essentially, every release of my application starts from scratch as far as user settings go. While this is a mild annoyance in development, it raises the question as I approach deployment/release - if I use the app.config to store my user settings, will the user's personalized