app-config

How do I save custom configuration sections during runtime?

穿精又带淫゛_ 提交于 2019-12-11 04:33:56
问题 My application allows the user to add additional items to a combobox that get saved in a custom configuration section. The issue is that the save() call fails because my app is installed to C:/Program Files... which do not have read-write permissions so the user must run my app as Administrator. Is there a more skillful way of saving user-added UI elements that persist? I looked into user settings but it doesn't seem like there is a way to save collections. 回答1: .NET doesn't really support

Reference Assembly in app.config

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 03:33:01
问题 I know this Question has been asked before but not in this Context! I have an WPF-Application(third party) that gives me the possibility to add an XAML ResourceDictionary, so I´ve created a ClassLibrary with a Class that Implements the ICommand Interface and calls a WebService in the Execute-Method. Now I want to attach this Command to a Control in the Application! This is my ResourceDictionary: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x=

Set DatabaseInitializerForType in config file for Custom Initializer to fire

99封情书 提交于 2019-12-11 03:17:22
问题 So I either get errors firing or nothing happens. I know that I have custom Entity Framework Initializer like this: using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EasyEntity { public class EasyInitializer : DropCreateDatabaseAlways<EasyContext> { protected override void Seed(EasyContext context) { List<Person> persons = new List<Person> { new Person { FirstName = "Waz", LastName = "Amattau

How do I configure my settings file to work with unit tests?

拟墨画扇 提交于 2019-12-11 02:59:36
问题 I have a library I'm writing unit tests for. The library is used by two applications: one a Windows service, the other a command-line application that does some registry read-writes. Each has a slightly different App.config file that is loaded from the library at start-up. For example: public RetentionService() { SettingHive = new Hive(); TimingService = new RetentionTimingService(SettingHive); AppSettingsReader asr = new AppSettingsReader(); object appsListObj = asr.GetValue(@"blocking

Accessing connection string from base form causes designer error

时间秒杀一切 提交于 2019-12-11 02:56:35
问题 I have a vb.net windows forms application in which I'm using inheritance for the windows forms. I have a base form that provides some of the basic layout and methods that will be used with all inheriting forms. This includes the initialization of an entity framework context in the base form constructor . Dim dataContext As New CCEntities() The child form can then make use of this context. The application compiles and runs without error, but when I try to view the child form in the designer,

How can we write our own configuration in App.config

匆匆过客 提交于 2019-12-11 02:48:38
问题 In one of my c# application, i have to write directories path inside config file as following Main Folder = Sites Sub Folders = 400, 500, 600, and so on For each subfolders = Inst, Prof Inside Inst and Prof , we have multiple files. Inside my program, i have to fetch all sites (400, 500 etc) and then i have to write loop for all sites for both folders (Inst and Prof) one by one, once DONE then go for next site and so on What is best way to write above folder structure in App.config file? 回答1:

Different appenders based on build configuration in log4net

倾然丶 夕夏残阳落幕 提交于 2019-12-11 02:48:10
问题 My main application either starts in a console environment or as a Windows Service , based on certain indicators (launch flags, #if directive,...). As long as the application runs in ' production mode ', e.g. without a user context as a startup service, I want to log both in a file (info, warnings) as well as into the Windows event log . However when I'm debugging, I want log messages only been carried out to the console window. Is there any way to achieve this using log4net that doesn't

Internalisation using Spring Security In-Memory Authentication

百般思念 提交于 2019-12-11 02:37:16
问题 I have read the references manuals, looked at forum posts (such as, How to hold japanese characters in SPRING MVC POJO's field), and I as far as I know I have done all the things necessary for internationalisation Spring support, but I am having problems the Spring Security 3 In-Memory username matching using Unicode/special characters. Note, that my application uses UTF-8 and all appears well and all works well including entering Unicode password (however, this Unicode password may well be

Change file name <AssemblyName.exe.config> to <App.Config> for output directory in Visual Studio

╄→гoц情女王★ 提交于 2019-12-11 01:46:36
问题 I have a C# project and an App.Config file in this project. When i build the source code, a file (AssemblyName.exe.config) is created in the output directory for the application configuration but i want the name of this file App.Config. How can i do that? 回答1: but i want the name of this file App.Config. You can use a post-build event to rename the file. However, realize that the application settings architecture which uses the file will expect the name to be AssemblyName.exe.config . If you

Is there a way to store connection strings in a central location other than machine.config

喜你入骨 提交于 2019-12-11 01:21:48
问题 I am currently trying to ease the configuration hell that exists on our client-servers. We have something like 8 applications who each have their own connection string info, and we were hoping to store connection strings in a central location to make our poor support team's life easier. However, I have been asked to avoid doing this in machine.config because (1) we are frequently not the only third party on servers at client sites and apparently (this concern shouldn't matter as long as we