Questions tagged [configurationelement]

27 questions
14
votes
5 answers

Custom Configuration, ConfigurationElements, and ConfigurationProperties

I've been scouring the net for the last 3 days, and can't find any reference to this question. I've created a custom configuration class to be used with my app.config. Everything works fine. The problem comes in when a configuration property (of a…
user62064
  • 185
  • 1
  • 3
  • 10
11
votes
3 answers

How to revert an HttpError ConfigurationElement back to "Inherited" using IIS 7 API

Suppose I have the following collection in a web.config: Yep, nice 'n empty. And in IIS 7, my HTTP errors page looks like this: Beautiful! (I've highlighted 404 simply because that's the example I'll use in…
joshcomley
  • 28,099
  • 24
  • 107
  • 147
11
votes
3 answers

Loading a ConfigurationSection with a required child ConfigurationElement with .Net configuration framework

I have a console application that is trying to load a CustomConfigurationSection from a web.config file. The custom configuration section has a custom configuration element that is required. This means that when I load the config section, I expect…
7
votes
1 answer

How do I use .NET custom ConfigurationElement properties on descendent elements?

How can I get and use an attribute set in the parent ConfigurationSection in the descendent CustomSetting element? I need this attribute when the CustomSetting element is returning the Value property. I want to format the App.config like…
7
votes
2 answers

Getting config element from ConfigurationElementCollection

I have (hopefully) setup ConfigurationElementCollection of my own design with emails as keys. Now what? Hard to find actually on the web. How do I: iterate through it? See if a specific element exists? get a specific element? ...given: …
Martin
  • 2,956
  • 7
  • 30
  • 59
6
votes
2 answers

.NET base type cannot be serialized by WCF

I'm writing a WCF service and want to expose some custom configuration elements (e.g. Custom ConfigurationSection and ConnectionStringSettings) so that I can modify the service's configuration. One of my custom configuration elements inherits from…
5
votes
3 answers

DateTime property in a ConfigurationElement

I'm wanting to put a DateTime in to the config file, however, I want the DateTime expressed in a specific way. I've seen examples of using a DateTime in a ConfigurationElement (like the example below). The examples I've seen all have the date…
Big Hair
  • 53
  • 1
  • 5
4
votes
3 answers

ConfigurationSection multiple enum values

Is there a way to set multiple enum values in a configuration section? Like you do in .net object.Filter = Filter.Update | Filter.Create; Is something like that supported?
3
votes
2 answers

Unable to read in my custom .config section

NOTE: this is very very similar to this SO question, but I need some more help. i'm trying to make the following section in my .config file, but i get an exception when trying to access this section. .config file
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
3
votes
1 answer

.NET config: Read a value in the specified Type

I have the following node in my web.config which is read into the following ConfigurationProperty public class ParameterElement : ConfigurationElement { [ConfigurationProperty("type",…
awj
  • 7,482
  • 10
  • 66
  • 120
2
votes
1 answer

.NET ConfigurationElementCollection.Add method does not add item to collection

I have a custom configuration section running under ASP.NET 4.0 that I would like to save changes to. The classes involved are: QueueConfiguration: a ConfigurationElement QueueCollection Queues // a list of queues to be…
Eric Patrick
  • 2,097
  • 2
  • 20
  • 31
2
votes
1 answer

How better to map configuration elements to application objects?

I have a .NET application which has a custom configuration to re-construct some classes on startup. That's not a plain (de)serialization, that's more complex and mixed. class FooElement : ConfigurationElement { static ConfigurationProperty…
abatishchev
  • 98,240
  • 88
  • 296
  • 433
2
votes
1 answer

Is it possible to create a ConfigurationElement from xml text?

We have a custom class that inherits from ConfigurationElement called SignalConfigurationElement and defines a bunch of properties using the ConfigurationProperty attribute. The SignalConfigurationElement class is part of a much larger hierarchy of…
Brandon
  • 4,491
  • 6
  • 38
  • 59
1
vote
1 answer

ConfigurationElement—Combination of Attributes?

Say I have defined a custom AdapterElement : ConfigurationElement with properties Type, Name and Version. Since Name and Version uniquelly identifies the Type property, I would like to enforce the configuration file to have one of the following…
1
vote
1 answer

Can't set DefaultValue for ConfigurationProperty of Custom ConfigurationElement type

I have a small problem with DefaultValue for ConfigurationProperty. Here is the part of my XML config : UNC To process this config, I've created "StorageElement : ConfigurationElement" : public…
Degot
  • 139
  • 4
  • 8
1
2