Could not load ConfigurationSection class - type
Posted
by nCdy
on Stack Overflow
See other posts from Stack Overflow
or by nCdy
Published on 2010-03-18T06:07:47Z
Indexed on
2010/03/18
6:11 UTC
Read the original article
Hit count: 480
at web.config
<section name="FlowWebDataProviders" type="FlowWebProvidersSection" requirePermission="false"/>
<FlowWebDataProviders peopleProviderName="sqlProvider" IzmListProviderName="sqlProvider">
<PeopleProviders>
<add name="sqlProvider" type="SqlPeopleProvider" connectionStringName="FlowServerConnectionString"/>
<add name="xmlProvider" type="XmlPeopleProvider" schemaFile="People.xsd" dataFile="People.xml"/>
</PeopleProviders>
<IzmListProviders>
<add name="sqlProvider" type="SqlIzmListProvider" connectionStringName="FlowServerConnectionString"/>
</IzmListProviders>
</FlowWebDataProviders>
and
public class FlowWebProvidersSection : ConfigurationSection
{
[ConfigurationProperty("peopleProviderName", IsRequired = true)]
public PeopleProviderName : string
{
get { this["peopleProviderName"] :> string }
set { this["peopleProviderName"] = value; }
}
[ConfigurationProperty("IzmListProviderName", IsRequired = true)]
public IzmListProviderName : string
{
get { (this["IzmListProviderName"] :> string) }
set { this["IzmListProviderName"] = value; }
}
[ConfigurationProperty("PeopleProviders")]
[ConfigurationValidatorAttribute(typeof(ProviderSettingsValidation))]
public PeopleProviders : ProviderSettingsCollection
{
get { this["PeopleProviders"] :> ProviderSettingsCollection }
}
[ConfigurationProperty("IzmListProviders")]
[ConfigurationValidatorAttribute(typeof(ProviderSettingsValidation))]
public IzmListProviders : ProviderSettingsCollection
{
get { this["IzmListProviders"] :> ProviderSettingsCollection }
}
}
and
public class ProviderSettingsValidation : ConfigurationValidatorBase
{
public override CanValidate(typex : Type) : bool
{
if(typex : object == typeof(ProviderSettingsCollection)) true else false
}
/// <summary>
// validate the provider section
/// </summary>
public override Validate(value : object) : void
{
mutable providerCollection : ProviderSettingsCollection = match(value)
{
| x is ProviderSettingsCollection => x
| _ => null
}
unless (providerCollection == null)
{
foreach (_provider is ProviderSettings in providerCollection)
{
when (String.IsNullOrEmpty(_provider.Type))
{
throw ConfigurationErrorsException("Type was not defined in the provider");
}
mutable dataAccessType : Type = Type.GetType(_provider.Type);
when (dataAccessType == null)
{
throw (InvalidOperationException("Provider's Type could not be found"));
}
}
}
}
}
project : Web Application ...
I need to find error first . . .
why :
Error message parser: Error creating configuration section handler for FlowWebDataProviders: Could not load type 'FlowWebProvidersSection'.
?
by the way : syntax of nemerle (current language) is very similar C#, don't afraid to read the code... thank you
© Stack Overflow or respective owner