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); }
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); }
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); }
static private void HandleRemove(XmlNode child, NameValueCollection config) { HandlerBase.CheckForChildNodes(child); String name = RemoveAttribute(child, "name"); HandlerBase.CheckForUnrecognizedAttributes(child); config.Remove(name); }
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); }
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(); } }
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); }
/* * 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); }
static private void HandleClear(XmlNode child, DataTable config) { HandlerBase.CheckForChildNodes(child); HandlerBase.CheckForUnrecognizedAttributes(child); config.Clear(); }
static private void HandleClear(XmlNode child, NameValueCollection config) { HandlerBase.CheckForChildNodes(child); HandlerBase.CheckForUnrecognizedAttributes(child); config.Clear(); }