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
- KeyedCollection.cs
- WindowsGraphics.cs
- Translator.cs
- UnsafeNativeMethods.cs
- KeyEventArgs.cs
- SqlConnection.cs
- AssemblyUtil.cs
- LabelTarget.cs
- GridSplitter.cs
- EntityClientCacheKey.cs
- Column.cs
- RedistVersionInfo.cs
- ComplusEndpointConfigContainer.cs
- ReferenceEqualityComparer.cs
- CodeObjectCreateExpression.cs
- WindowsContainer.cs
- DynamicQueryableWrapper.cs
- RsaKeyIdentifierClause.cs
- IndexedGlyphRun.cs
- ConfigErrorGlyph.cs
- TransportChannelListener.cs
- ServiceHostingEnvironment.cs
- TextElement.cs
- TimelineCollection.cs
- Interlocked.cs
- TypeSemantics.cs
- DataView.cs
- RegistryKey.cs
- DataBoundControlAdapter.cs
- PointHitTestResult.cs
- VBIdentifierName.cs
- StandardCommands.cs
- RawKeyboardInputReport.cs
- AnnotationHelper.cs
- CodeSnippetExpression.cs
- ViewPort3D.cs
- IResourceProvider.cs
- Vector3DAnimationBase.cs
- CircleHotSpot.cs
- NegatedCellConstant.cs
- ObjectManager.cs
- ImageButton.cs
- HttpVersion.cs
- XamlWriterExtensions.cs
- ConfigurationManager.cs
- UseLicense.cs
- UIPropertyMetadata.cs
- WinFormsSecurity.cs
- ElementsClipboardData.cs
- COM2PropertyDescriptor.cs
- XmlSchemaExternal.cs
- DictionaryEntry.cs
- SlipBehavior.cs
- ListCardsInFileRequest.cs
- TextEndOfParagraph.cs
- SaveFileDialog.cs
- XmlSchemaSimpleTypeUnion.cs
- AtomEntry.cs
- FileAuthorizationModule.cs
- X509CertificateTrustedIssuerElementCollection.cs
- ExclusiveCanonicalizationTransform.cs
- MasterPageBuildProvider.cs
- BinarySerializer.cs
- Switch.cs
- TreeNodeStyleCollection.cs
- RegexTypeEditor.cs
- CAGDesigner.cs
- CustomAttributeBuilder.cs
- Color.cs
- AutomationElement.cs
- TabRenderer.cs
- DataGridViewCheckBoxColumn.cs
- TableLayoutPanelDesigner.cs
- WS2007FederationHttpBinding.cs
- XmlSchemaValidator.cs
- HttpHandlersSection.cs
- Operator.cs
- Evidence.cs
- CancelEventArgs.cs
- ServiceOperationListItemList.cs
- CodeArrayCreateExpression.cs
- PartManifestEntry.cs
- DataPager.cs
- ValidatedControlConverter.cs
- oledbmetadatacolumnnames.cs
- InvokeGenerator.cs
- UserControl.cs
- KeyValueSerializer.cs
- EntityContainer.cs
- RsaKeyIdentifierClause.cs
- Fonts.cs
- SwitchLevelAttribute.cs
- MonthCalendar.cs
- Panel.cs
- Simplifier.cs
- AccessDataSourceWizardForm.cs
- BitmapEffectCollection.cs
- PinnedBufferMemoryStream.cs
- RichTextBox.cs
- ImageDrawing.cs