2010-03-18 15 views
1

à web.configImpossible de charger la classe ConfigurationSection - Type

<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> 

et

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 } 
    } 
    } 

et

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")); 
      } 
     } 
     } 
    } 
    } 

projet: Application Web ...

J'ai besoin pour trouver l'erreur en premier. . .

pourquoi:

erreur analyseur de message: Erreur de création gestionnaire de section de configuration pour FlowWebDataProviders: Impossible de charger le type 'FlowWebProvidersSection'.

?

par la voie: la syntaxe de nemerle (langage courant) est très similaire C#, ne pas avoir peur de lire le code ... Merci

ajouté: voilà comment je veux la section

ConfigurationManager.GetSection("FlowWebDataProviders") 

Répondre

1

Vérifiez votre type AND espace de noms. C'est à dire.

<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /> 
+0

si je l'utilise « MyNamespace.FlowWebProvidersSection » a une erreur: Type de fournisseur n'a pas pu être trouvé (il est le dernier code dans la question) donc je suppose qu'il fonde ma classe, mais ne peut pas le charger:/aucune idée Pourquoi – Cynede