/// <summary> /// Creates a new instance of <see cref="ConnectorConfiguration"/> based on the configuration. /// </summary> /// <param name="parent"></param> /// <param name="configContext"></param> /// <param name="section"></param> /// <returns></returns> public object Create(object parent, object configContext, System.Xml.XmlNode section) { var conf = new ConnectorConfiguration(); XPathNavigator nav = section.CreateNavigator(); conf.User = GetValue(nav, "user"); conf.Key = GetValue(nav, "key"); conf.HostsRaw = GetValue(nav, "hosts"); conf.MainHostsRaw = GetValue(nav, "mainHosts"); conf.FastHostsRaw = GetValue(nav, "fastHosts"); return(conf); }
public object Create(object parent, object configContext, System.Xml.XmlNode section) { XElement x = XElement.Parse(section.CreateNavigator().OuterXml); List <RouteRule> routes = x.Elements().Select(r => new RouteRule { UrlRule = r.Attribute("urlRule").Value, RedirectTo = r.Attribute("redirectTo").Value, RouteHandler = r.Attribute("routeHandler") == null ? "Default" : r.Attribute("routeHandler").Value }).ToList(); routeRuleCollection = new RouteRuleCollection(routes); return(routeRuleCollection); }