internal ConfigWriter(System.Configuration.Configuration configuration)
        {
            this.bindingsSection = BindingsSection.GetSection(configuration);
            ServiceModelSectionGroup sectionGroup = ServiceModelSectionGroup.GetSectionGroup(configuration);

            this.channels = sectionGroup.Client.Endpoints;
            this.config   = configuration;
        }
Esempio n. 2
0
            public static Binding GetFromConfig(string configurationName)
            {
                var bingingsSection = BindingsSection.GetSection(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None));
                var bindingType     = (from b in bingingsSection.BindingCollections
                                       where b.ConfiguredBindings.Count > 0 && b.ContainsKey(configurationName)
                                       select b.BindingType).FirstOrDefault();
                var binding = bindingType != null?Activator.CreateInstance(bindingType, configurationName) : null;

                return((Binding)binding);
            }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var config          = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            var bingingsSection = BindingsSection.GetSection(config);

            string netTcpSource    = bingingsSection.NetTcpBinding.ElementInformation.Source;
            string basicHttpSource = bingingsSection.BasicHttpBinding.ElementInformation.Source;

            Console.WriteLine("Net TCP Binding came from \"{0}\"", netTcpSource);
            Console.WriteLine("Basic HTTP Binding came from \"{0}\"", basicHttpSource);
        }
Esempio n. 4
0
        internal ConfigWriter(Configuration configuration)
        {
            this.bindingTable = new Dictionary <Binding, BindingDictionaryValue>();

            this.bindingsSection = BindingsSection.GetSection(configuration);

            ServiceModelSectionGroup serviceModelSectionGroup = ServiceModelSectionGroup.GetSectionGroup(configuration);

            this.channels = serviceModelSectionGroup.Client.Endpoints;
            this.config   = configuration;
        }