custom-configuration

How do I make my custom config section behave like a collection?

自古美人都是妖i 提交于 2019-12-03 02:57:07
How would I need to write my custom ConfigurationSection so that it is both a section handler and a configuration element collection? Normally, you have one class that inherits from ConfigurationSection , which then has a property that is of a type that inherits from ConfigurationElementCollection , which then returns elements of a collection of a type that inherits from ConfigurationElement . To configure that, you would then need XML that looks something like this: <customSection> <collection> <element name="A" /> <element name="B" /> <element name="C" /> </collection> </customSection> I

Custom configuration files - Play! Framework 2.0

蹲街弑〆低调 提交于 2019-12-01 02:07:36
问题 I have a question about loading properties from custom configuration files. I have tried two different approaches to loading my oauth.properties file but I can't get either to work so I'm hoping someone here can help me. The first approach I tried was to add the file to the conf directory and reference it thusly: String oauthPropertiesFile = ClassLoader.getSystemResource("oauth.properties").getFile(); But that just returned NULL . The second approach I tries was to add: @include

Custom Config section in App.config C#

风格不统一 提交于 2019-11-29 01:05:05
问题 I'm a quite beginner with config sections in c# I want to create a custom section in config file. What I've tried after googling is as the follows Config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="MyCustomSections"> <section name="CustomSection" type="CustomSectionTest.CustomSection,CustomSection"/> </sectionGroup> </configSections> <MyCustomSections> <CustomSection key="Default"/> </MyCustomSections> </configuration> CustomSection.cs

Moving a custom configuration group to a separate file

陌路散爱 提交于 2019-11-26 22:57:45
问题 I've recently wrote a rather large custom configuration group. I'm curious if it is possible to move this configuration to a separate file via the following: <configuration> <configSections> <sectionGroup name="MyCustomGroup"> <section name="MyCustomSection"/> </sectionGroup> </configSections> <MyCustomGroup file="alt.config" /> </configuration> This is something similar to what you can do with the file attribute for appSettings. I realize there is most likely a need to create a