Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / CustomBinding.cs / 1 / CustomBinding.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Channels { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Configuration; using System.Globalization; using System.ServiceModel.Configuration; using System.Net.Security; using System.ServiceModel.Security; public class CustomBinding : Binding { BindingElementCollection bindingElements = new BindingElementCollection(); public CustomBinding() : base() { } public CustomBinding(string configurationName) { ApplyConfiguration(configurationName); } public CustomBinding(params BindingElement[] bindingElementsInTopDownChannelStackOrder) : base() { if (bindingElementsInTopDownChannelStackOrder == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements"); } foreach (BindingElement element in bindingElementsInTopDownChannelStackOrder) { this.bindingElements.Add(element); } } public CustomBinding(string name, string ns, params BindingElement[] bindingElementsInTopDownChannelStackOrder) : base(name, ns) { if (bindingElementsInTopDownChannelStackOrder == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements"); } foreach (BindingElement element in bindingElementsInTopDownChannelStackOrder) { this.bindingElements.Add(element); } } public CustomBinding(IEnumerablebindingElementsInTopDownChannelStackOrder) { if (bindingElementsInTopDownChannelStackOrder == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements"); } foreach (BindingElement element in bindingElementsInTopDownChannelStackOrder) { this.bindingElements.Add(element); } } internal CustomBinding(BindingElementCollection bindingElements) : base() { if (bindingElements == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements"); } for (int i = 0; i < bindingElements.Count; i++) { this.bindingElements.Add(bindingElements[i]); } } public CustomBinding(Binding binding) : this(binding, SafeCreateBindingElements(binding)) { } static BindingElementCollection SafeCreateBindingElements(Binding binding) { if (binding == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding"); } return binding.CreateBindingElements(); } internal CustomBinding(Binding binding, BindingElementCollection elements) { if (binding == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding"); } if (elements == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("elements"); } this.Name = binding.Name; this.Namespace = binding.Namespace; this.CloseTimeout = binding.CloseTimeout; this.OpenTimeout = binding.OpenTimeout; this.ReceiveTimeout = binding.ReceiveTimeout; this.SendTimeout = binding.SendTimeout; for (int i = 0; i < elements.Count; i++) { bindingElements.Add(elements[i]); } } public BindingElementCollection Elements { get { return bindingElements; } } public override BindingElementCollection CreateBindingElements() { return this.bindingElements.Clone(); } void ApplyConfiguration(string configurationName) { CustomBindingCollectionElement section = CustomBindingCollectionElement.GetBindingCollectionElement(); CustomBindingElement element = section.Bindings[configurationName]; if (element == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.ConfigInvalidBindingConfigurationName, configurationName, ConfigurationStrings.CustomBindingCollectionElementName))); } else { element.ApplyConfiguration(this); } } public override string Scheme { get { TransportBindingElement transport = bindingElements.Find (); if (transport == null) { return String.Empty; } return transport.Scheme; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EdmSchemaError.cs
- InArgument.cs
- RedirectionProxy.cs
- RequiredFieldValidator.cs
- PartialCachingAttribute.cs
- GatewayIPAddressInformationCollection.cs
- Hyperlink.cs
- ServiceBusyException.cs
- GridViewHeaderRowPresenter.cs
- TextEffect.cs
- AnimatedTypeHelpers.cs
- XmlUrlResolver.cs
- ManagementScope.cs
- OperationInfoBase.cs
- AggregationMinMaxHelpers.cs
- ActiveXHelper.cs
- JsonEncodingStreamWrapper.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- SiteMapDataSource.cs
- DocumentViewerConstants.cs
- AuthenticatedStream.cs
- SafeRightsManagementQueryHandle.cs
- TypeLibConverter.cs
- webbrowsersite.cs
- AnnotationMap.cs
- InvokeMemberBinder.cs
- Pair.cs
- TextRangeEditTables.cs
- DataGridViewCellCancelEventArgs.cs
- PropertyGeneratedEventArgs.cs
- FontDialog.cs
- NullableDecimalSumAggregationOperator.cs
- ExpressionConverter.cs
- BatchStream.cs
- FixedElement.cs
- TextCollapsingProperties.cs
- HTMLTextWriter.cs
- FirstMatchCodeGroup.cs
- graph.cs
- DataSysAttribute.cs
- DefaultTextStore.cs
- DataControlButton.cs
- IteratorFilter.cs
- ReadOnlyCollectionBase.cs
- GuidTagList.cs
- SafeHandles.cs
- XPathDocumentBuilder.cs
- DataBindingCollectionEditor.cs
- FileClassifier.cs
- COM2PictureConverter.cs
- TextOnlyOutput.cs
- ObjectMaterializedEventArgs.cs
- EncryptedType.cs
- RelationshipConverter.cs
- ListBox.cs
- Classification.cs
- ElapsedEventArgs.cs
- CellPartitioner.cs
- GroupBoxDesigner.cs
- ObjectDataProvider.cs
- ADMembershipUser.cs
- UniformGrid.cs
- AddingNewEventArgs.cs
- Rfc4050KeyFormatter.cs
- ImageMap.cs
- DataServiceEntityAttribute.cs
- InstanceNormalEvent.cs
- EventLogPermissionEntryCollection.cs
- StylusPointPropertyId.cs
- Binding.cs
- DictionaryEditChange.cs
- TargetException.cs
- ParameterCollectionEditor.cs
- KernelTypeValidation.cs
- AuthenticationManager.cs
- HttpContextWrapper.cs
- ColumnHeaderConverter.cs
- TextLineResult.cs
- _SslState.cs
- SpellerInterop.cs
- UnauthorizedAccessException.cs
- XmlName.cs
- GeneralTransform2DTo3D.cs
- RtfToken.cs
- MimeXmlReflector.cs
- FaultPropagationRecord.cs
- ObjectQueryState.cs
- CommentEmitter.cs
- CommandEventArgs.cs
- SqlCacheDependencySection.cs
- BinaryFormatter.cs
- HatchBrush.cs
- basemetadatamappingvisitor.cs
- DesigntimeLicenseContext.cs
- DocumentXmlWriter.cs
- CaretElement.cs
- MenuItemBinding.cs
- MouseActionValueSerializer.cs
- Serializer.cs
- CellParagraph.cs