示例#1
0
        static internal object CreateStatic(object parent, object configContext, XmlNode section)
        {
            object config = parent;

            if (null != section)
            {
                config = CloneParent(parent as NameValueCollection);
                bool foundSettings = false;

                HandlerBase.CheckForUnrecognizedAttributes(section);
                foreach (XmlNode child in section.ChildNodes)
                {
                    if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child))
                    {
                        continue;
                    }
                    string sectionGroup = child.Name;
                    switch (sectionGroup)
                    {
                    case DbProviderConfigurationHandler.settings:
                        if (foundSettings)
                        {
                            throw ADP.ConfigSectionsUnique(DbProviderConfigurationHandler.settings);
                        }
                        foundSettings = true;
                        DbProviderDictionarySectionHandler.CreateStatic(config as NameValueCollection, configContext, child);
                        break;

                    default:
                        throw ADP.ConfigUnrecognizedElement(child);
                    }
                }
            }
            return(config);
        }
示例#2
0
        static internal object CreateStatic(object parent, object configContext, XmlNode section)
        {
            object config = parent;

            if (null != section)
            {
                config = HandlerBase.CloneParent(parent as DataSet, false);
                bool foundFactories = false;

                HandlerBase.CheckForUnrecognizedAttributes(section);
                foreach (XmlNode child in section.ChildNodes)
                {
                    if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child))
                    {
                        continue;
                    }
                    string sectionGroup = child.Name;
                    switch (sectionGroup)
                    {
                    case DbProviderFactoriesConfigurationHandler.providerGroup:
                        if (foundFactories)
                        {
                            throw ADP.ConfigSectionsUnique(DbProviderFactoriesConfigurationHandler.providerGroup);
                        }
                        foundFactories = true;
                        HandleProviders(config as DataSet, configContext, child, sectionGroup);
                        break;

                    default:
                        throw ADP.ConfigUnrecognizedElement(child);
                    }
                }
            }
            return(config);
        }
示例#3
0
            static internal NameValueCollection CreateStatic(NameValueCollection config, Object context, XmlNode section)
            {
                if (null != section)
                {
                    HandlerBase.CheckForUnrecognizedAttributes(section);
                }

                foreach (XmlNode child in section.ChildNodes)
                {
                    if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child))
                    {
                        continue;
                    }
                    switch (child.Name)
                    {
                    case "add":
                        HandleAdd(child, config);
                        break;

                    case "remove":
                        HandleRemove(child, config);
                        break;

                    case "clear":
                        HandleClear(child, config);
                        break;

                    default:
                        throw ADP.ConfigUnrecognizedElement(child);
                    }
                }
                return(config);
            }
示例#4
0
            /*
             * internal DbProviderDictionarySectionHandler() {
             * }
             *
             * public object Create(Object parent, Object context, XmlNode section) {
             *  return CreateStatic(parent, context, section);
             * }
             */

            static internal DataTable CreateStatic(DataTable config, Object context, XmlNode section)
            {
                if (null != section)
                {
                    HandlerBase.CheckForUnrecognizedAttributes(section);

                    if (null == config)
                    {
                        config = DbProviderFactoriesConfigurationHandler.CreateProviderDataTable();
                    }
                    // else already copied via DataSet.Copy

                    foreach (XmlNode child in section.ChildNodes)
                    {
                        if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child))
                        {
                            continue;
                        }
                        switch (child.Name)
                        {
                        case "add":
                            HandleAdd(child, config);
                            break;

                        case "remove":
                            HandleRemove(child, config);
                            break;

                        case "clear":
                            HandleClear(child, config);
                            break;

                        default:
                            throw ADP.ConfigUnrecognizedElement(child);
                        }
                    }
                    config.AcceptChanges();
                }
                return(config);
            }