Reading custom configuration from web.config return null

Im trying to read out values from the databases/add element, but it throws exception each time. Whats wrong here... I dont get it.

This code is in its own assembly if thats a clue.

Configuration in web.config

<sectionGroup name="sessionFactoryConfiguration">
  <section name="Databases" type="Boot.Multitenancy.Configuration.SessionFactoryConfiguration, ConfigurationCollectionAttribute"/>

        <add name="" autoPersist="true" dbType="SqlCe"/>
        <add name="" autoPersist="true" dbType="SqlCe"/>

Try to get the values from the section. I

var conf = ConfigurationManager.GetSection("Databases") as SessionFactoryConfiguration;
      if (conf == null)
            throw new Exception("Not loaded"); //Throws exception each time.

Implementation of sections.

public class DatabaseSection : ConfigurationElement
    public DatabaseSection() { }
    public DatabaseSection(String name, bool autoPersist, DbType dbtype)
        this.Name = name;
        this.AutoPersist = autoPersist;
        this.DbType = dbtype;

    public String Name
        get { return (String)this["name"]; }
        set { this["name"] = value; }

    [ConfigurationProperty("autoPersist", DefaultValue = false, IsRequired = false)]
    public Boolean AutoPersist
        get { return (Boolean)this["autoPersist"]; }
        set { this["autoPersist"] = value; }

    /// <summary>
    /// DbType
    /// </summary>
    [ConfigurationProperty("dbType", DefaultValue = DbType.SqlCe, IsRequired = false)]
    public DbType DbType
        get { return (DbType)this["dbType"]; }
        set { this["dbType"] = value; }

The ConfigurationCollection attribute added to class.

public class SessionFactoryConfiguration : ConfigurationSection
    [ConfigurationProperty("Databases", IsDefaultCollection = false)]
    [ConfigurationCollection(typeof(DatabaseCollection), AddItemName = "add", ClearItemsName = "clear", RemoveItemName = "remove")]
    public DatabaseCollection Databases
        get { return (DatabaseCollection)base["Databases"]; }

public class DatabaseCollection : ConfigurationElementCollection
    public DatabaseCollection()

    public override ConfigurationElementCollectionType CollectionType
        get { return ConfigurationElementCollectionType.AddRemoveClearMap; }

    protected override ConfigurationElement CreateNewElement()
        return new DatabaseSection();
 ....//long code



So simple... I just needed to change the ConfigurationCollectionAttribute to my assemblyname in web configuration...

In each sample they refer to this attribute...

From: section name="sessionFactoryConfiguration" type="Boot.Multitenancy.Configuration.SessionFactoryConfiguration, ConfigurationCollectionAttribute"/>

To: section name="sessionFactoryConfiguration" type="Boot.Multitenancy.Configuration.SessionFactoryConfiguration, Boot.Multitenancy"/>

Need Your Help

Bootstrap 3 and Typeahead.js issue

javascript php jquery twitter-bootstrap typeahead.js

I'm having a problem with bootstrap 3 and typeahead.js from github