Sending .NET configuration section over the wire using WCF

יום שני, ספטמבר 7, 2009

Hi, Have you ever needed to implement configuration sections for the application configuration file? Well probably you have. Let's say you want to read the configuration section from your *.config file and send it thru WCF service. The default behavior when working with configuration object is use the System.Configuration namespace that doesn't support WCF. So the question is what can we do? A nice solution is to use the IConfigurationSectionHandler interface and mark the section implementation as a DataContract. It will be something like:     public class MyConfigurationSectionHandler : IConfigurationSectionHandler     {         #region IConfigurationSectionHandler Members           public object Create(object parent, object configContext, System.Xml.XmlNode section)        ...