application-settings

Convention based binding of constructor string arguments with Ninject

十年热恋 提交于 2019-12-04 04:13:26
I'm using Ninject as IoC container in my project. I have following class: public class SomeRepository:ISomeRepository { public SomeRepository(string someDatabaseConnectionString) { // some code here.. } } In my application settings file I have connection string named "someDatabase". By default the one should add following configuration in order to inject this connection string into the constructor: kernel.Bind<ISomeRepository>() .To<SomeRepository>() .WithConstructorArgument("someDatabaseConnectionString", connString); But i want to implement conventional based binding of such strings. Values

ConfigurationManager.AppSettings Returns Null In Unit Test Project

混江龙づ霸主 提交于 2019-12-03 11:19:02
问题 I have a C# unit test project with application settings in the app.config file. I am testing a class that exists in a different project. That class depends on both, ConfigurationManager.AppSettings and ConfigurationManager.ConnectionStrings . The project that the class being tested resides in does not have an app.config file. I would have thought that because the class is being instantiated in the context of the unit test project that it would use the unit test project's app.config file.

Store String Array with Values in Application Settings [duplicate]

泄露秘密 提交于 2019-12-03 10:18:53
This question already has an answer here: How to save a List<string> on Settings.Default? 3 answers I've modified my Settings.settings file in order to have system_Filters be a System.String[] . I would like to populate this variable within the Visual Studio designer and not from within the code. I can get it to work within the code using the following: Properties.Settings.Default.system_Filters = new string[] { "a", "b", "c" }; string _systemFilters = Properties.Settings.Default.system_Filters; This works correctly. However, I don't have a nice place to put this in my code and ideally want to

Multiple applications with different names for the same code base

冷暖自知 提交于 2019-12-03 07:46:20
问题 Reading this article, thought having the same problem - One code base, two applications on Android I have created an application testApp that has items like topics , splash screens , logos , charts , rules , statuses and/or events . Now, I want different applications ( testApp_USA , testApp_Canada , testApp_Australia )from the same code base and put them on Google Play Store so that if user downloads the application, say, testApp_USA , then only the specific items to that region should be

How to use different .settings files for different environments in .NET?

自古美人都是妖i 提交于 2019-12-03 06:08:19
问题 .NET allows you to use .settings files to manage application settings. I would like to store Production, Development and Test settings separately in a way that I can do something like this: EnvironmentSettings environmentSettings; // get the current environment (Production, Development or Test) ApplicationEnvironment Environment = (ApplicationEnvironment) Enum.Parse(typeof(ApplicationEnvironment), Settings.Default.ApplicationEnvironment); switch (Environment) { case ApplicationEnvironment

ConfigurationManager.AppSettings Returns Null In Unit Test Project

荒凉一梦 提交于 2019-12-03 01:41:34
I have a C# unit test project with application settings in the app.config file. I am testing a class that exists in a different project. That class depends on both, ConfigurationManager.AppSettings and ConfigurationManager.ConnectionStrings . The project that the class being tested resides in does not have an app.config file. I would have thought that because the class is being instantiated in the context of the unit test project that it would use the unit test project's app.config file. Indeed, that does seem to be the case for the connection string. The class retrieves the connection string

How do I store desktop application data in a cross platform way for python?

浪子不回头ぞ 提交于 2019-12-03 01:02:32
问题 I have a python desktop application that needs to store user data. On Windows, this is usually in %USERPROFILE%\Application Data\AppName\ , on OSX it's usually ~/Library/Application Support/AppName/ , and on other *nixes it's usually ~/.appname/ . There exists a function in the standard library, os.path.expanduser that will get me a user's home directory, but I know that on Windows, at least, "Application Data" is localized into the user's language. That might be true for OSX as well. What is

How to use different .settings files for different environments in .NET?

妖精的绣舞 提交于 2019-12-02 19:34:01
.NET allows you to use .settings files to manage application settings. I would like to store Production, Development and Test settings separately in a way that I can do something like this: EnvironmentSettings environmentSettings; // get the current environment (Production, Development or Test) ApplicationEnvironment Environment = (ApplicationEnvironment) Enum.Parse(typeof(ApplicationEnvironment), Settings.Default.ApplicationEnvironment); switch (Environment) { case ApplicationEnvironment.Production: environmentSettings = Settings.Production; break; ... } string reportOutputLocation =

How do I store desktop application data in a cross platform way for python?

廉价感情. 提交于 2019-12-02 16:21:50
I have a python desktop application that needs to store user data. On Windows, this is usually in %USERPROFILE%\Application Data\AppName\ , on OSX it's usually ~/Library/Application Support/AppName/ , and on other *nixes it's usually ~/.appname/ . There exists a function in the standard library, os.path.expanduser that will get me a user's home directory, but I know that on Windows, at least, "Application Data" is localized into the user's language. That might be true for OSX as well. What is the correct way to get this location? UPDATE: Some further research indicates that the correct way to

Reading default application settings in C#

☆樱花仙子☆ 提交于 2019-12-02 15:35:50
I have a number of application settings (in user scope) for my custom grid control. Most of them are color settings. I have a form where the user can customize these colors and I want to add a button for reverting to default color settings. How can I read the default settings? For example: I have a user setting named CellBackgroundColor in Properties.Settings . At design time I set the value of CellBackgroundColor to Color.White using the IDE. User sets CellBackgroundColor to Color.Black in my program. I save the settings with Properties.Settings.Default.Save() . User clicks on the Restore