Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / PeerCustomResolverElement.cs / 1 / PeerCustomResolverElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System.Configuration; using System.ServiceModel.Description; using System.Globalization; using System.Net; using System.Net.Security; using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.PeerResolvers; using System.ComponentModel; public sealed partial class PeerCustomResolverElement : ConfigurationElement { [ConfigurationProperty(ConfigurationStrings.Address, DefaultValue = null, Options = ConfigurationPropertyOptions.None)] public Uri Address { get {return (Uri) base[ConfigurationStrings.Address]; } set {base[ConfigurationStrings.Address] = value; } } [ConfigurationProperty(ConfigurationStrings.Headers)] public AddressHeaderCollectionElement Headers { get { return (AddressHeaderCollectionElement)base[ConfigurationStrings.Headers]; } } [ConfigurationProperty(ConfigurationStrings.Identity)] public IdentityElement Identity { get { return (IdentityElement)base[ConfigurationStrings.Identity]; } } [ConfigurationProperty(ConfigurationStrings.Binding, DefaultValue = "")] [StringValidator(MinLength = 0)] public string Binding { get { return (string)base[ConfigurationStrings.Binding]; } set { base[ConfigurationStrings.Binding] = value; } } [ConfigurationProperty(ConfigurationStrings.BindingConfiguration, DefaultValue = "")] [StringValidator(MinLength = 0)] public string BindingConfiguration { get { return (string)base[ConfigurationStrings.BindingConfiguration]; } set { base[ConfigurationStrings.BindingConfiguration] = value; } } [ConfigurationProperty(ConfigurationStrings.PeerResolverType, DefaultValue = "")] [StringValidator(MinLength = 0)] public string ResolverType { get { return (string)base[ConfigurationStrings.PeerResolverType]; } set { base[ConfigurationStrings.PeerResolverType] = value; } } internal void ApplyConfiguration(PeerCustomResolverSettings settings) { if (settings == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); } if (this.Address != null) { settings.Address = new EndpointAddress(this.Address, ConfigLoader.LoadIdentity(this.Identity), this.Headers.Headers); } settings.BindingSection = this.Binding; settings.BindingConfiguration = this.BindingConfiguration; if (!String.IsNullOrEmpty(this.Binding) && !String.IsNullOrEmpty(this.BindingConfiguration)) settings.Binding = ConfigLoader.LookupBinding(this.Binding, this.BindingConfiguration); if (!String.IsNullOrEmpty(this.ResolverType)) { Type myResolverType = Type.GetType(this.ResolverType, false); if (myResolverType != null) { settings.Resolver = Activator.CreateInstance(myResolverType) as PeerResolver; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.PeerResolverInvalid, this.ResolverType))); } } } internal void InitializeFrom(PeerCustomResolverSettings settings) { if (settings == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); } if(settings.Address != null) { this.Address = settings.Address.Uri; this.Identity.InitializeFrom(settings.Address.Identity); } if(settings.Resolver != null) { this.ResolverType = settings.Resolver.GetType().AssemblyQualifiedName; } if(settings.Binding != null) { this.BindingConfiguration = PeerStrings.PeerCustomResolver+Guid.NewGuid().ToString(); string sectionName; BindingsSection.TryAdd(this.BindingConfiguration, settings.Binding, out sectionName); this.Binding = sectionName; } } } } // 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
- Bidi.cs
- PrivilegeNotHeldException.cs
- SqlNodeAnnotations.cs
- propertytag.cs
- LocatorManager.cs
- listviewsubitemcollectioneditor.cs
- ChangeInterceptorAttribute.cs
- ApplicationDirectoryMembershipCondition.cs
- SmiSettersStream.cs
- ChannelBuilder.cs
- ProfilePropertyMetadata.cs
- TextParagraphView.cs
- KeyInterop.cs
- UpdatePanel.cs
- DefaultHttpHandler.cs
- TimelineGroup.cs
- StateRuntime.cs
- RegexCompiler.cs
- StringFormat.cs
- TraceSection.cs
- InvalidOperationException.cs
- UnsafeNativeMethods.cs
- SimplePropertyEntry.cs
- SqlTypeSystemProvider.cs
- PermissionAttributes.cs
- MappedMetaModel.cs
- ReferenceConverter.cs
- ManagementOptions.cs
- ReflectionHelper.cs
- LoginCancelEventArgs.cs
- View.cs
- ComponentDispatcher.cs
- SynchronizationValidator.cs
- SmiEventSink_Default.cs
- LogSwitch.cs
- WaitHandleCannotBeOpenedException.cs
- CssStyleCollection.cs
- ReadOnlyCollectionBase.cs
- DbDataReader.cs
- C14NUtil.cs
- DPTypeDescriptorContext.cs
- SystemDiagnosticsSection.cs
- SignedXml.cs
- XsltConvert.cs
- DefaultPrintController.cs
- Component.cs
- TransformerConfigurationWizardBase.cs
- CompositeClientFormatter.cs
- cookie.cs
- AutomationPropertyInfo.cs
- PackageRelationshipSelector.cs
- CodeGen.cs
- ChineseLunisolarCalendar.cs
- AbstractSvcMapFileLoader.cs
- TraceSection.cs
- TraceData.cs
- TextDecorations.cs
- IconBitmapDecoder.cs
- OleDbConnectionInternal.cs
- ExpandableObjectConverter.cs
- CookieHandler.cs
- MetadataWorkspace.cs
- DesignerAutoFormatStyle.cs
- Encoder.cs
- ScrollBar.cs
- DataGridItem.cs
- DocobjHost.cs
- Missing.cs
- RecordsAffectedEventArgs.cs
- RMEnrollmentPage1.cs
- WebServiceHost.cs
- Stream.cs
- HttpModule.cs
- BrowserTree.cs
- ToolBarTray.cs
- DropShadowBitmapEffect.cs
- OLEDB_Util.cs
- StylusEventArgs.cs
- SQLInt64Storage.cs
- HttpInputStream.cs
- GeometryHitTestParameters.cs
- DesignerAttribute.cs
- ServiceModelConfigurationElementCollection.cs
- DynamicUpdateCommand.cs
- BlurBitmapEffect.cs
- DesignerAttribute.cs
- ClientSettingsStore.cs
- ToolTip.cs
- ClientFormsAuthenticationCredentials.cs
- TextTreeObjectNode.cs
- LicenseException.cs
- PerfCounters.cs
- ObjectQueryExecutionPlan.cs
- FormViewPagerRow.cs
- XmlWriterDelegator.cs
- IMembershipProvider.cs
- ErrorFormatterPage.cs
- Int16.cs
- ToolBarButtonClickEvent.cs
- ConfigurationPermission.cs