/// <summary>
        /// Initialize the Discriminator
        /// </summary>
        /// <param name="configScope"></param>
        public void Initialize(ConfigurationScope configScope)
        {
            // Set the ResultMaps
            int count = _subMaps.Count;

            for (int index = 0; index < count; index++)
            {
                SubMap subMap = _subMaps[index] as SubMap;
                _resultMaps.Add(subMap.DiscriminatorValue, configScope.SqlMapper.GetResultMap(subMap.ResultMapName));
            }
        }
        /// <summary>
        /// Get the result properties and the subMap properties.
        /// </summary>
        /// <param name="configScope"></param>
        private void GetChildNode(ConfigurationScope configScope)
        {
            ResultProperty mapping = null;
            SubMap         subMap  = null;

            #region Load the parameters constructor
            XmlNodeList nodeList = configScope.NodeContext.SelectNodes(DomSqlMapBuilder.ApplyMappingNamespacePrefix(XML_CONSTRUCTOR_ARGUMENT), configScope.XmlNamespaceManager);
            if (nodeList.Count > 0)
            {
                Type[]   parametersType = new Type[nodeList.Count];
                string[] parametersName = new string[nodeList.Count];
                for (int i = 0; i < nodeList.Count; i++)
                {
                    ArgumentProperty argumentMapping = ArgumentPropertyDeSerializer.Deserialize(nodeList[i], configScope);
                    _parameters.Add(argumentMapping);
                    parametersName[i] = argumentMapping.ArgumentName;
                }
                ConstructorInfo constructorInfo = this.GetConstructor(_class, parametersName);
                for (int i = 0; i < _parameters.Count; i++)
                {
                    ArgumentProperty argumentMapping = (ArgumentProperty)_parameters[i];

                    configScope.ErrorContext.MoreInfo = "initialize argument property : " + argumentMapping.ArgumentName;
                    argumentMapping.Initialize(configScope, constructorInfo);
                    parametersType[i] = argumentMapping.MemberType;
                }
                // Init the object factory
                _objectFactory = configScope.SqlMapper.ObjectFactory.CreateFactory(_class, parametersType);
            }
            else
            {
                if (Type.GetTypeCode(_class) == TypeCode.Object)
                {
                    _objectFactory = configScope.SqlMapper.ObjectFactory.CreateFactory(_class, Type.EmptyTypes);
                }
            }

            #endregion

            #region Load the Result Properties

            foreach (XmlNode resultNode in configScope.NodeContext.SelectNodes(DomSqlMapBuilder.ApplyMappingNamespacePrefix(XML_RESULT), configScope.XmlNamespaceManager))
            {
                mapping = ResultPropertyDeSerializer.Deserialize(resultNode, configScope);

                configScope.ErrorContext.MoreInfo = "initialize result property: " + mapping.PropertyName;

                mapping.Initialize(configScope, _class);

                _properties.Add(mapping);
            }
            #endregion

            #region Load the Discriminator Property

            XmlNode discriminatorNode = configScope.NodeContext.SelectSingleNode(DomSqlMapBuilder.ApplyMappingNamespacePrefix(XML_DISCRIMNATOR), configScope.XmlNamespaceManager);
            if (discriminatorNode != null)
            {
                configScope.ErrorContext.MoreInfo = "initialize discriminator";

                this.Discriminator = DiscriminatorDeSerializer.Deserialize(discriminatorNode, configScope);
                this.Discriminator.SetMapping(configScope, _class);
            }
            #endregion

            #region Load the SubMap Properties

            if (configScope.NodeContext.SelectNodes(DomSqlMapBuilder.ApplyMappingNamespacePrefix(XML_SUBMAP), configScope.XmlNamespaceManager).Count > 0 && this.Discriminator == null)
            {
                throw new ConfigurationException("The discriminator is null, but somehow a subMap was reached.  This is a bug.");
            }
            foreach (XmlNode resultNode in configScope.NodeContext.SelectNodes(DomSqlMapBuilder.ApplyMappingNamespacePrefix(XML_SUBMAP), configScope.XmlNamespaceManager))
            {
                configScope.ErrorContext.MoreInfo = "initialize subMap";
                subMap = SubMapDeSerializer.Deserialize(resultNode, configScope);

                subMap.ResultMapName = _sqlMapNameSpace + DomSqlMapBuilder.DOT + subMap.ResultMapName;
                this.Discriminator.Add(subMap);
            }
            #endregion
        }
 /// <summary>
 /// Add a subMap that the discrimator must treat
 /// </summary>
 /// <param name="subMap">A subMap</param>
 public void Add(SubMap subMap)
 {
     _subMaps.Add(subMap);
 }