/// <summary>
        ///     <para>Overriden. Reads the factory configuration.</para>
        /// </summary>
        /// <param name="reader">
        ///     <para>The <see cref="XmlReader"/> to read from.</para>
        /// </param>
        public override void ReadXml(XmlReader reader)
        {
            _memoryPoolInitialBufferSize = null;
            _storageSection = null;
            using (var subReader = reader.ReadSubtree())
            {
                subReader.Read();
                while (subReader.Read())
                {
                    if (subReader.NodeType == XmlNodeType.Element)
                    {
                        switch (subReader.Name)
                        {
                        case _binaryStorageElementName:
                            _storageSection = GenericFactoryConfigurationSection <IBinaryStorage> .FromXml(subReader);

                            break;

                        case _memoryPoolElementName:
                            _memoryPoolInitialBufferSize =
                                subReader.ReadElementContentAsInt();
                            break;
                        }
                    }
                }
            }
            if (_storageSection == null)
            {
                throw new ApplicationException(
                          "No binary storage configuration found");
            }
        }
        /// <summary>
        ///     <para>Overriden. Reads XML from the configuration file.</para>
        /// </summary>
        /// <param name="reader">
        ///     <para>The <see cref="System.Xml.XmlReader"/> that reads from the configuration file.</para>
        /// </param>
        /// <param name="serializeCollectionKey">
        ///     <para>true to serialize only the collection key properties; otherwise, false.</para>
        /// </param>
        /// <exception cref="System.Configuration.ConfigurationErrorsException">
        ///     <para>The element to read is locked.                     - or -                     An attribute of the current node is not recognized.                     - or -                     The lock status of the current node cannot be determined.</para>
        /// </exception>
        protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
        {
            using (reader = reader.ReadSubtree())
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        switch (reader.Name)
                        {
                        case "typePolicy":
                            TypePolicy = new GenericFactoryConfigurationSection <ITypePolicy>();
                            ((IXmlSerializable)TypePolicy).ReadXml(reader);
                            break;

                        case "storage":
                            Storage = new GenericFactoryConfigurationSection <IObjectStorage>();
                            ((IXmlSerializable)Storage).ReadXml(reader);
                            break;
                        }
                    }
                }
            }
        }