internal void InitializeFrom(PeerCustomResolverSettings settings) { if (settings == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); } if (settings.Address != null) { SetPropertyValueIfNotDefaultValue(ConfigurationStrings.Address, settings.Address.Uri); this.Identity.InitializeFrom(settings.Address.Identity); } if (settings.Resolver != null) { SetPropertyValueIfNotDefaultValue(ConfigurationStrings.PeerResolverType, settings.Resolver.GetType().AssemblyQualifiedName); } if (settings.Binding != null) { SetPropertyValueIfNotDefaultValue(ConfigurationStrings.BindingConfiguration, PeerStrings.PeerCustomResolver + Guid.NewGuid().ToString()); string sectionName; BindingsSection.TryAdd(this.BindingConfiguration, settings.Binding, out sectionName); this.Binding = sectionName; } }
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))); } } }
public PeerCustomResolverBindingElement(BindingContext context, PeerCustomResolverSettings settings) : this(settings) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("context")); } this.credentials = context.BindingParameters.Find <ClientCredentials>(); }
public PeerCustomResolverBindingElement(BindingContext context, PeerCustomResolverSettings settings) : this(settings) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("context")); } #pragma warning suppress 56506 // Microsoft, context.BindingParameters is never null credentials = context.BindingParameters.Find <ClientCredentials>(); }
public PeerCustomResolverBindingElement(PeerCustomResolverSettings settings) { if (settings != null) { this.address = settings.Address; this.binding = settings.Binding; this.resolver = settings.Resolver; this.bindingConfiguration = settings.BindingConfiguration; this.bindingSection = settings.BindingSection; } }
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) { string str; this.BindingConfiguration = "PeerCustomResolver" + Guid.NewGuid().ToString(); BindingsSection.TryAdd(this.BindingConfiguration, settings.Binding, out str); this.Binding = str; } }
public PeerCustomResolverBindingElement(PeerCustomResolverSettings settings) { this.settings = settings; }
public PeerCustomResolverBindingElement(BindingContext context, PeerCustomResolverSettings settings) : this(settings) { this.context = context; }
public PeerCustomResolverBindingElement() { settings = new PeerCustomResolverSettings(); }