当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.ChannelEndpointElement类代码示例

本文整理汇总了C#中System.ServiceModel.Configuration.ChannelEndpointElement的典型用法代码示例。如果您正苦于以下问题:C# ChannelEndpointElement类的具体用法?C# ChannelEndpointElement怎么用?C# ChannelEndpointElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChannelEndpointElement类属于System.ServiceModel.Configuration命名空间,在下文中一共展示了ChannelEndpointElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigurationDiscoveryEndpointProvider

        public ConfigurationDiscoveryEndpointProvider(ChannelEndpointElement channelEndpointElement)
        {
            Fx.Assert(channelEndpointElement != null, "The channelEndpointElement parameter must be non null.");

            ConfigurationDiscoveryEndpointProvider.ValidateAndGetDiscoveryEndpoint(channelEndpointElement);
            this.channelEndpointElement = channelEndpointElement;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ConfigurationDiscoveryEndpointProvider.cs

示例2: ValidateAndGetDiscoveryEndpoint

        static DiscoveryEndpoint ValidateAndGetDiscoveryEndpoint(ChannelEndpointElement channelEndpointElement)
        {
            if (string.IsNullOrEmpty(channelEndpointElement.Kind))
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                    SR2.DiscoveryConfigDiscoveryEndpointMissingKind(
                    typeof(DiscoveryEndpoint).FullName)));
            }

            ServiceEndpoint serviceEndpoint = ConfigLoader.LookupEndpoint(channelEndpointElement, null);

            if (serviceEndpoint == null)
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                    SR2.DiscoveryConfigInvalidEndpointConfiguration(
                    channelEndpointElement.Kind)));
            }

            DiscoveryEndpoint discoveryEndpoint = serviceEndpoint as DiscoveryEndpoint;
            if (discoveryEndpoint == null)
            {
                throw FxTrace.Exception.AsError(
                    new InvalidOperationException(
                        SR2.DiscoveryConfigInvalidDiscoveryEndpoint(
                        typeof(DiscoveryEndpoint).FullName,
                        channelEndpointElement.Kind,
                        serviceEndpoint.GetType().FullName)));
            }

            return discoveryEndpoint;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:ConfigurationDiscoveryEndpointProvider.cs

示例3: ApplyConfiguration

        public void ApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
        {
            if (null == endpoint)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint");
            }

            if (null == channelEndpointElement)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
            }

            if (endpoint.GetType() != this.EndpointType)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ConfigInvalidTypeForEndpoint,
                    this.EndpointType.AssemblyQualifiedName,
                    endpoint.GetType().AssemblyQualifiedName));
            }

            // The properties endpoint.Name and this.Name are actually two different things:
            //     - endpoint.Name corresponds to the service endpoint name and is surfaced through
            //       serviceEndpointElement.Name
            //     - this.Name is a token used as a key in the endpoint collection to identify
            //       a specific bucket of configuration settings.
            // Thus, the Name property is skipped here.

            this.OnApplyConfiguration(endpoint, channelEndpointElement);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:28,代码来源:StandardEndpointElement.cs

示例4: InitializeAndValidate

 public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (channelEndpointElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
     }
     this.OnInitializeAndValidate(channelEndpointElement);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:StandardEndpointElement.cs

示例5: OnInitializeAndValidate

 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (String.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = ConfigurationStrings.MexHttpBindingCollectionElementName;
     }
     channelEndpointElement.Contract = ServiceMetadataBehavior.MexContractName;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:ServiceMetadataEndpointElement.cs

示例6: OnInitializeAndValidate

 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (string.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = "mexHttpBinding";
     }
     channelEndpointElement.Contract = "IMetadataExchange";
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ServiceMetadataEndpointElement.cs

示例7: WriteChannelDescription

 internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
 {
     ChannelEndpointElement element = null;
     BindingDictionaryValue value2 = this.CreateBindingConfig(endpoint.Binding);
     element = new ChannelEndpointElement(endpoint.Address, typeName);
     element.Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), new NamingHelper.DoesNameExist(this.CheckIfChannelNameInUse), null);
     element.BindingConfiguration = value2.BindingName;
     element.Binding = value2.BindingSectionName;
     this.channels.Add(element);
     return element;
 }
开发者ID:gtri-iead,项目名称:LEXS-NET-Sample-Implementation-3.1.4,代码行数:11,代码来源:ConfigWriter.cs

示例8: TestEmptyProps

		public void TestEmptyProps ()
		{
			ChannelEndpointElement empty = new ChannelEndpointElement ();
			Assert.AreEqual ("", empty.Name, "#01");
			Assert.AreEqual (null, empty.Contract, "#02");
			Assert.AreEqual (null, empty.Binding, "#03");
			Assert.AreEqual (null, empty.Address, "#04");
			Assert.AreEqual ("", empty.BindingConfiguration, "#05");
			Assert.AreEqual ("", empty.BehaviorConfiguration, "#06");
			Assert.IsNotNull (empty.Headers, "#07");
			Assert.IsNotNull (empty.Identity, "#08");
		}
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:ChannelEndpointElementTest.cs

示例9: TestMatchingContractBySpecificName

        public void TestMatchingContractBySpecificName()
        {
            // Construct configuration settings
            ChannelEndpointElement endpoint1 = new ChannelEndpointElement(null, typeof(ITestService).FullName) { Name = "Test1" };
            ChannelEndpointElement endpoint2 = new ChannelEndpointElement(null, typeof(ITestService).FullName + "0000") { Name = "Test2" };
            ServiceModelSectionGroup context = this.CreateServiceModelSectionGroup();
            context.Client.Endpoints.Add(endpoint1);
            context.Client.Endpoints.Add(endpoint2);

            Assert.DoesNotThrow(delegate { this.LoadServiceEndPoint("Test1", context); });
            Assert.Throws(typeof(InvalidOperationException), delegate { this.LoadServiceEndPoint("TestXYZ", context); });
            Assert.Throws(typeof(InvalidOperationException), delegate { this.LoadServiceEndPoint("Test2", context); });
        }
开发者ID:bigT,项目名称:CustomConfigurationChannelFactory,代码行数:13,代码来源:ConfigurationLoaderTestsEndpoints.cs

示例10: Copy

        internal void Copy(ChannelEndpointElement source)
        {
            if (source == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }

            PropertyInformationCollection properties = source.ElementInformation.Properties;
            if (properties[ConfigurationStrings.Address].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Address = source.Address;
            }
            if (properties[ConfigurationStrings.BehaviorConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BehaviorConfiguration = source.BehaviorConfiguration;
            }
            if (properties[ConfigurationStrings.Binding].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Binding = source.Binding;
            }
            if (properties[ConfigurationStrings.BindingConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BindingConfiguration = source.BindingConfiguration;
            }
            if (properties[ConfigurationStrings.Name].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Name = source.Name;
            }
            if (properties[ConfigurationStrings.Contract].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Contract = source.Contract;
            }
            if (properties[ConfigurationStrings.Headers].ValueOrigin != PropertyValueOrigin.Default
                && source.Headers != null)
            {
                this.Headers.Copy(source.Headers);
            }
            if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default
                && source.Identity != null)
            {
                this.Identity.Copy(source.Identity);
            }
            if (properties[ConfigurationStrings.Kind].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Kind = source.Kind;
            }
            if (properties[ConfigurationStrings.EndpointConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.EndpointConfiguration = source.EndpointConfiguration;
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:51,代码来源:ChannelEndpointElement.cs

示例11: InitializeAndValidate

        public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
        {
            if (null == channelEndpointElement)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
            }

            // The properties channelEndpointElement.Name and this.Name are actually two different things:
            //     - channelEndpointElement.Name corresponds to the service endpoint name
            //     - this.Name is a token used as a key in the endpoint collection to identify
            //       a specific bucket of configuration settings.
            // Thus, the Name property is skipped here.

            this.OnInitializeAndValidate(channelEndpointElement);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:StandardEndpointElement.cs

示例12: Copy

 internal void Copy(ChannelEndpointElement source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     PropertyInformationCollection properties = source.ElementInformation.Properties;
     if (properties["address"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Address = source.Address;
     }
     if (properties["behaviorConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.BehaviorConfiguration = source.BehaviorConfiguration;
     }
     if (properties["binding"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Binding = source.Binding;
     }
     if (properties["bindingConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.BindingConfiguration = source.BindingConfiguration;
     }
     if (properties["name"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Name = source.Name;
     }
     if (properties["contract"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Contract = source.Contract;
     }
     if ((properties["headers"].ValueOrigin != PropertyValueOrigin.Default) && (source.Headers != null))
     {
         this.Headers.Copy(source.Headers);
     }
     if ((properties["identity"].ValueOrigin != PropertyValueOrigin.Default) && (source.Identity != null))
     {
         this.Identity.Copy(source.Identity);
     }
     if (properties["kind"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Kind = source.Kind;
     }
     if (properties["endpointConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.EndpointConfiguration = source.EndpointConfiguration;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:ChannelEndpointElement.cs

示例13: ApplyConfiguration

 public void ApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
 {
     if (endpoint == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint");
     }
     if (channelEndpointElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
     }
     if (endpoint.GetType() != this.EndpointType)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ConfigInvalidTypeForEndpoint", new object[] { this.EndpointType.AssemblyQualifiedName, endpoint.GetType().AssemblyQualifiedName }));
     }
     this.OnApplyConfiguration(endpoint, channelEndpointElement);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:StandardEndpointElement.cs

示例14: OnInitializeAndValidate

        protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
        {
            if (string.IsNullOrEmpty(channelEndpointElement.Contract))
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                        SR.DiscoveryConfigContractNotSpecified(channelEndpointElement.Kind)));
            }

            if (channelEndpointElement.Address != null && !channelEndpointElement.Address.Equals(DiscoveryClientBindingElement.DiscoveryEndpointAddress.Uri))
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                            SR.DiscoveryEndpointAddressIncorrect(
                            "address",
                            channelEndpointElement.Address, 
                            DiscoveryClientBindingElement.DiscoveryEndpointAddress.Uri)));
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:19,代码来源:DynamicEndpointElement.cs

示例15: WriteChannelDescription

        internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
        {
            ChannelEndpointElement channelElement = null;

            // Create Binding
            BindingDictionaryValue bindingDV = CreateBindingConfig(endpoint.Binding);


            channelElement = new ChannelEndpointElement(endpoint.Address, typeName);

            // [....]: review: Use decoded form to preserve the user-given friendly name, however, beacuse our Encoding algorithm
            // does not touch ASCII names, a name that looks like encoded name will not roundtrip(Example: "_x002C_" will turned into ",")
            channelElement.Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), this.CheckIfChannelNameInUse, null);

            channelElement.BindingConfiguration = bindingDV.BindingName;
            channelElement.Binding = bindingDV.BindingSectionName;
            channels.Add(channelElement);

            return channelElement;            
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:ConfigWriter.cs


注:本文中的System.ServiceModel.Configuration.ChannelEndpointElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。