예제 #1
0
        public RoutingTable()
        {
            this.filterTable           = new XPathMessageFilterTable <EndpointAddress>();
            this.randomNumberGenerator = new Random();

            XmlNamespaceManager manager = new XPathMessageContext();

            XmlReader        routingTableDataFileReader = XmlReader.Create(ConfigurationManager.AppSettings["routingTableXmlFile"]);
            RoutingTableData routingTableData           = (RoutingTableData) new XmlSerializer(typeof(RoutingTableData)).Deserialize(routingTableDataFileReader);

            foreach (RouterNamespace ns in routingTableData.RouterNamespacesSection.RouterNamespaces)
            {
                manager.AddNamespace(ns.Prefix, ns.NamespaceUri);
            }

            foreach (Route route in routingTableData.RoutesSection.Routes)
            {
                this.filterTable.Add(new XPathMessageFilter(route.XPath, manager), new EndpointAddress(route.Uri));
            }
        }
예제 #2
0
        public RoutingTable()
        {
            this.filterTable = new XPathMessageFilterTable<EndpointAddress>();
            this.randomNumberGenerator = new Random();

            XmlNamespaceManager manager = new XPathMessageContext();

            XmlReader routingTableDataFileReader = XmlReader.Create(ConfigurationManager.AppSettings["routingTableXmlFile"]);
            RoutingTableData routingTableData = (RoutingTableData)new XmlSerializer(typeof(RoutingTableData)).Deserialize(routingTableDataFileReader);

            foreach (RouterNamespace ns in routingTableData.RouterNamespacesSection.RouterNamespaces)
            {
                manager.AddNamespace(ns.Prefix, ns.NamespaceUri);
            }

            foreach (Route route in routingTableData.RoutesSection.Routes)
            {
                this.filterTable.Add(new XPathMessageFilter(route.XPath, manager), new EndpointAddress(route.Uri));
            }
        }