private void PopulateConfigNodes(XmlNode section)
        {
            const string Config_Node_Name = "config";

            foreach (XmlNode node in section.ChildNodes)
            {
                if (node.NodeType != XmlNodeType.Element)
                {
                    continue;
                }

                if (!Config_Node_Name.Equals(node.Name))
                {
                    String message = String.Format("Unexpected node. Expect '{0}' found '{1}'",
                                                   Config_Node_Name, node.Name);

                    throw new ConfigurationErrorsException(message);
                }

                Type targetType = typeof(ActiveRecordBase);

                IDictionary <string, string> defaults = null;
                if (node.Attributes.Count != 0)
                {
                    XmlAttribute typeNameAtt = node.Attributes["type"];

                    if (typeNameAtt != null)
                    {
                        String typeName = typeNameAtt.Value;

                        targetType = Type.GetType(typeName, false, false);

                        if (targetType == null)
                        {
                            String message = String.Format("Could not obtain type from name '{0}'", typeName);

                            throw new ConfigurationErrorsException(message);
                        }
                    }

                    var databaseName         = node.Attributes["database"] ?? node.Attributes["db"];
                    var connectionStringName = node.Attributes["connectionStringName"] ?? node.Attributes["csn"];
                    if (databaseName != null && connectionStringName != null)
                    {
                        defaults = SetDefaults(databaseName.Value, connectionStringName.Value);
                    }
                    else if (databaseName != null || connectionStringName != null)
                    {
                        var message =
                            String.Format(
                                "Using short form of configuration requires both 'database' and 'connectionStringName' attributes to be specified.");
                        throw new ConfigurationErrorsException(message);
                    }
                }

                Add(targetType, BuildProperties(node, defaults));
            }
        }
        private void PopulateConfigNodes(XmlNode section)
        {
            const string Config_Node_Name = "config";

            foreach (XmlNode node in section.ChildNodes)
            {
                if (node.NodeType != XmlNodeType.Element)
                {
                    continue;
                }

                if (!Config_Node_Name.Equals(node.Name))
                {
                    String message = String.Format("Unexpected node. Expect '{0}' found '{1}'",
                                                   Config_Node_Name, node.Name);

                    throw new ConfigurationErrorsException(message);
                }

                String typeName = "Default";

                if (node.Attributes.Count != 0)
                {
                    XmlAttribute typeNameAtt = node.Attributes["type"];

                    if (typeNameAtt == null)
                    {
                        String message = String.Format("Invalid attribute at node '{0}'. " +
                                                       "The only supported attribute is 'type'", Config_Node_Name);

                        throw new ConfigurationErrorsException(message);
                    }

                    typeName = typeNameAtt.Value;
                }

                Add(typeName, BuildProperties(node));
            }
        }