2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 using System.Configuration;
6 using System.ServiceModel;
7 using System.ServiceModel.Channels;
8 using System.ServiceModel.Configuration;
9 using System.ServiceModel.Description;
10 using System.ServiceModel.Dispatcher;
12 namespace System.ServiceModel.Routing.Configuration
14 public class RoutingSection : ConfigurationSection
17 public static MessageFilterTable<IEnumerable<ServiceEndpoint>> CreateFilterTable (string name)
19 throw new NotImplementedException ();
21 // FIXME: I feel messed.
22 var sec = (RoutingSection) ConfigurationManager.GetSection ("system.serviceModel/routing");
23 var endpoints = ((ServiceModelSectionGroup) ConfigurationManager.GetSection ("system.serviceModel")).Client.Endpoints;
24 var table = new MessageFilterTable<IEnumerable<ServiceEndpoint>> ();
25 var ftec = (FilterTableEntryCollection) sec.FilterTables [name];
26 foreach (FilterTableEntryElement fte in ftec) {
27 var filter = table.Keys.FirstOrDefault (f => ((EndpointNameMessageFilter) f).Name == fte.FilterName);
29 filter = new EndpointNameMessageFilter (fte.EndpointName);
30 table.Add (filter, new List<ServiceEndpoint> ());
32 var list = table [filter];
33 var bec = (BackupEndpointCollection) sec.BackupLists [fte.BackupList];
34 foreach (var bee in bec)
35 list.Add (endpoints [bee.EndpointName]);
41 public RoutingSection ()
43 BackupLists = new BackupListCollection ();
44 Filters = new FilterElementCollection ();
45 FilterTables = new FilterTableCollection ();
46 NamespaceTable = new NamespaceElementCollection ();
49 [ConfigurationProperty ("backupLists", Options = ConfigurationPropertyOptions.None)]
50 public BackupListCollection BackupLists { get; private set; }
52 [ConfigurationProperty ("filters", Options = ConfigurationPropertyOptions.None)]
53 public FilterElementCollection Filters { get; private set; }
55 [ConfigurationProperty ("filterTables", Options = ConfigurationPropertyOptions.None)]
56 public FilterTableCollection FilterTables { get; private set; }
58 [ConfigurationProperty ("namespaceTable", Options = ConfigurationPropertyOptions.None)]
59 public NamespaceElementCollection NamespaceTable { get; private set; }