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
- XmlWhitespace.cs
- SQLByte.cs
- AmbientValueAttribute.cs
- DesignerView.Commands.cs
- Tablet.cs
- PrintDialog.cs
- ToolBar.cs
- glyphs.cs
- PackageRelationshipSelector.cs
- UrlAuthFailedErrorFormatter.cs
- WebPartEditorOkVerb.cs
- DefaultProxySection.cs
- RoutedCommand.cs
- MinimizableAttributeTypeConverter.cs
- DataGridViewControlCollection.cs
- XMLDiffLoader.cs
- Matrix3DStack.cs
- StylusPointPropertyInfo.cs
- RegexFCD.cs
- SmiContext.cs
- Vector3DConverter.cs
- ToolstripProfessionalRenderer.cs
- DataSetMappper.cs
- PhoneCall.cs
- LocalizabilityAttribute.cs
- TableLayoutSettingsTypeConverter.cs
- SecureUICommand.cs
- RewritingValidator.cs
- FunctionImportMapping.cs
- Zone.cs
- ExpressionEvaluator.cs
- ZipIOFileItemStream.cs
- CustomExpression.cs
- ComplexType.cs
- Translator.cs
- MetaType.cs
- UriTemplateMatch.cs
- Action.cs
- BufferedGraphicsManager.cs
- UnionCqlBlock.cs
- XsdCachingReader.cs
- UshortList2.cs
- RelatedView.cs
- Barrier.cs
- ToolStripArrowRenderEventArgs.cs
- DesignerSerializationOptionsAttribute.cs
- TypeToTreeConverter.cs
- ComponentSerializationService.cs
- RadioButtonFlatAdapter.cs
- ParsedAttributeCollection.cs
- ClockGroup.cs
- SubstitutionResponseElement.cs
- GridToolTip.cs
- ComponentEditorPage.cs
- BinHexDecoder.cs
- DataGridViewLayoutData.cs
- MdImport.cs
- RegexCapture.cs
- KoreanLunisolarCalendar.cs
- BidirectionalDictionary.cs
- ListViewGroup.cs
- TextureBrush.cs
- HttpCacheParams.cs
- DataObjectAttribute.cs
- AmbiguousMatchException.cs
- ResetableIterator.cs
- GlyphShapingProperties.cs
- TextContainer.cs
- DirectoryGroupQuery.cs
- XslCompiledTransform.cs
- PropertyCollection.cs
- WorkerRequest.cs
- XmlTextEncoder.cs
- OleDbStruct.cs
- DataListItem.cs
- Rectangle.cs
- ScalarRestriction.cs
- DataGridColumnCollectionEditor.cs
- ProxySimple.cs
- TextSpanModifier.cs
- DebugHandleTracker.cs
- EmissiveMaterial.cs
- IntMinMaxAggregationOperator.cs
- ApplicationManager.cs
- SqlBooleanMismatchVisitor.cs
- StaticExtension.cs
- TableCell.cs
- ToolStripContainer.cs
- WinEventHandler.cs
- DisplayInformation.cs
- TextRangeProviderWrapper.cs
- TdsValueSetter.cs
- XmlNamespaceMapping.cs
- SoapRpcMethodAttribute.cs
- MessageDispatch.cs
- ComponentResourceKeyConverter.cs
- SpecialFolderEnumConverter.cs
- PropertyDescriptorGridEntry.cs
- XamlClipboardData.cs
- SimpleLine.cs