C# - Moq ConfigurationSection?

Dec 8, 2010

my application has the following code:

public interface IConfigurationManager {
CustomSection Settings { get; }
}

[code]...

View 1 Replies


Similar Messages:

C# - Add A Textnode Instead Of An Attribute In A .NET Configurationsection?

Feb 22, 2011

I currently have a .NET custom configurationsection that looks like this:

<customSection name="My section" />

What I want is to write it as a textnode (I'm not sure if this is the correct term?) like this:

<customSection>
<name>My Section</name>
</customSection>

My current customSection class looks like this:

public class CustomSection: ConfigurationSection {
[ConfigurationProperty("name")]
public String Name {
get {
return (String)this["name"];
}
}
}

What should I do to make it a textnode?

View 1 Replies

System.Configuration.ConfigurationSection Not Available Under Class Library

Apr 30, 2010

I'm migrating a piece of functionality from my App_Code directory to a separate project that's going to build a class library to be referenced by my web app. One of my classes in the App_Code piece inherits form System.Configuration.ConfigurationSection, like so:

Imports System.Configuration
Imports System.Web.Configuration
Imports Microsoft.VisualBasic
Namespace P10.WebStore
#Region "WebStore Section"
Public Class WebStoreSection
Inherits ConfigurationSection

I absolutely cannot get the project to recognize ConfigurationSection as a class. Nothing I google about this class mentions having to do anything special to use it. Is it because this is a class library and not an .exe or somethign?

View 1 Replies

C# - Specify A Range With The IntegerValidator Attribute On A Custom ConfigurationSection?

Jan 21, 2010

I have a class containing the following ConfigurationSection:

namespace DummyConsole {
class TestingComponentSettings: ConfigurationSection {
[ConfigurationProperty("waitForTimeSeconds", IsRequired=true)]
[IntegerValidator(MinValue = 1, MaxValue = 100, ExcludeRange = false)]

[Code]....

The value for the property 'waitForTimeSeconds' is not valid. The error is: The value must be inside the range 1-100.

If I change the IntegerValidator to have an ExcludeRage = true, I (obviously) get:

ConfigurationErrorsException was unhandled

The value for the property 'waitForTimeSeconds' is not valid. The error is: The value must not be in the range 1-100

If I then change the value of the property in the .config to a number higher than 100, it works.

If I change the validator to just have a MaxValue of 100 it works, but will also accept a value of -1.

Is it possible to use the IntegerValidatorAttribute with a range like this?

Edit to add

Confirmed as an issue by Microsoft.

View 1 Replies

Web Forms :: Changing From Website To Web Project: With Implementing ConfigurationSection?

Feb 22, 2010

I am using the ASP.NET Web Site Small Business Starter Kit as a starting point for a simple web app. I wanted to convert it to a web project from a web site for few reasons (better interaction with VisualSVN, etc..).

I converted pretty much evertyhing over without too much trouble. Only one page is having an issue - at first the one issue I had on this same Provider: I was getting an error message about the type for the class that inherits ConfigurationSection (ProviderSettingsValidation) could not be found. I did some googling and ofund I had to change the web.config, at the type section for the provider to use the full assembly name/type name instead of just the typename. But after doing this, I get a new error and find myself stuck and found nothing on google... here is unhandled exception message:

An error occurred creating the configuration section handler for SmallBusinessDataProviders: Type 'FooWeb.ProviderSettingsValidation' does not inherit from System.Configuration.IConfigurationSectionHandler'. (C:ProjectsFooWebFacingFooWebFooWebweb.config
line 5)

View 1 Replies

Configuration - Have Settings In The Web.config (and Access Them Using ConfigurationSection) Or In A Separate XML File?

Sep 20, 2010

I have few settings which I could place in a separate XML file and have them accessed in the Web app. Then I thought (thinking of one additional file to deploy), why not have them in the web.config itself. However, just because I need to have custom nodes, I can not have the settings under . So, I am thinking of creating a custom config handler following this. Would that be better than having a separate XML file? Is It going to be an overkill or performance wise? Is there a better way to go?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved