示例#1
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);
        }
示例#2
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);
        }
示例#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
            static private void HandleRemove(XmlNode child, NameValueCollection config)
            {
                HandlerBase.CheckForChildNodes(child);
                String name = RemoveAttribute(child, "name");

                HandlerBase.CheckForUnrecognizedAttributes(child);
                config.Remove(name);
            }
示例#5
0
            static private void HandleAdd(XmlNode child, NameValueCollection config)
            {
                // should add vaildate that setting is a known supported setting
                // (i.e. that the value of the name attribute is is good)
                HandlerBase.CheckForChildNodes(child);
                string name  = RemoveAttribute(child, "name");
                string value = RemoveAttribute(child, "value");

                HandlerBase.CheckForUnrecognizedAttributes(child);
                config.Add(name, value);
            }
示例#6
0
            static private void HandleRemove(XmlNode child, DataTable config)
            {
                HandlerBase.CheckForChildNodes(child);
                String invr = HandlerBase.RemoveAttribute(child, "invariant", true, false);

                HandlerBase.CheckForUnrecognizedAttributes(child);
                DataRow row = config.Rows.Find(invr);

                if (null != row)   // ignore invariants that don't exist
                {
                    row.Delete();
                }
            }
示例#7
0
            static private void HandleAdd(XmlNode child, DataTable config)
            {
                HandlerBase.CheckForChildNodes(child);
                DataRow values = config.NewRow();

                values[0] = HandlerBase.RemoveAttribute(child, "name", true, false);
                values[1] = HandlerBase.RemoveAttribute(child, "description", true, false);
                values[2] = HandlerBase.RemoveAttribute(child, "invariant", true, false);
                values[3] = HandlerBase.RemoveAttribute(child, "type", true, false);

                // because beta shipped recognizing "support=hex#", need to give
                // more time for other providers to remove it from the .config files
                HandlerBase.RemoveAttribute(child, "support", false, false);

                HandlerBase.CheckForUnrecognizedAttributes(child);
                config.Rows.Add(values);
            }
示例#8
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);
            }
示例#9
0
 static private void HandleClear(XmlNode child, DataTable config)
 {
     HandlerBase.CheckForChildNodes(child);
     HandlerBase.CheckForUnrecognizedAttributes(child);
     config.Clear();
 }
示例#10
0
 static private void HandleClear(XmlNode child, NameValueCollection config)
 {
     HandlerBase.CheckForChildNodes(child);
     HandlerBase.CheckForUnrecognizedAttributes(child);
     config.Clear();
 }