private static ChannelFactoryRef <TChannel> CreateChannelFactoryRef(EndpointTrait <TChannel> endpointTrait) { ChannelFactory <TChannel> channelFactory = endpointTrait.CreateChannelFactory(); channelFactory.TraceOpenAndClose = false; return(new ChannelFactoryRef <TChannel>(channelFactory)); }
protected ClientBase(Binding binding, EndpointAddress remoteAddress) { if (binding == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(binding)); } if (remoteAddress == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(remoteAddress)); } MakeCacheSettingReadOnly(); if (s_cacheSetting == CacheSetting.AlwaysOn) { _endpointTrait = new ProgrammaticEndpointTrait <TChannel>(binding, remoteAddress, null); InitializeChannelFactoryRef(); } else { _channelFactoryRef = new ChannelFactoryRef <TChannel>(new ChannelFactory <TChannel>(binding, remoteAddress)); _channelFactoryRef.ChannelFactory.TraceOpenAndClose = false; TryDisableSharing(); } }
public int GetHashCode(EndpointTrait <TChannel> obj) { if (obj == null) { return(0); } return(obj.GetHashCode()); }
protected ClientBase() { this.canShareFactory = true; this.syncRoot = new object(); this.finalizeLock = new object(); this.endpointTrait = new EndpointTrait <TChannel>("*", null, null); this.InitializeChannelFactoryRef(); }
static ChannelFactoryRef <TChannel> CreateChannelFactoryRef(EndpointTrait <TChannel> endpointTrait) { Fx.Assert(endpointTrait != null, "The endpointTrait should not be null when the factory can be shared."); ChannelFactory <TChannel> channelFactory = endpointTrait.CreateChannelFactory(); channelFactory.TraceOpenAndClose = false; return(new ChannelFactoryRef <TChannel>(channelFactory)); }
public bool Equals(EndpointTrait <TChannel> x, EndpointTrait <TChannel> y) { if (x != null) { return((y != null) && x.Equals(y)); } if (y != null) { return(false); } return(true); }
protected ClientBase(string endpointConfigurationName) { this.canShareFactory = true; this.syncRoot = new object(); this.finalizeLock = new object(); if (endpointConfigurationName == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpointConfigurationName"); } this.endpointTrait = new EndpointTrait <TChannel>(endpointConfigurationName, null, null); this.InitializeChannelFactoryRef(); }
protected ClientBase(InstanceContext callbackInstance) { this.canShareFactory = true; this.syncRoot = new object(); this.finalizeLock = new object(); if (callbackInstance == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("callbackInstance"); } this.endpointTrait = new EndpointTrait <TChannel>("*", null, callbackInstance); this.InitializeChannelFactoryRef(); }
protected ClientBase(InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) { this.canShareFactory = true; this.syncRoot = new object(); this.finalizeLock = new object(); if (callbackInstance == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("callbackInstance"); } if (endpointConfigurationName == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpointConfigurationName"); } if (remoteAddress == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("remoteAddress"); } this.endpointTrait = new EndpointTrait <TChannel>(endpointConfigurationName, new EndpointAddress(remoteAddress), callbackInstance); this.InitializeChannelFactoryRef(); }
protected ClientBase(ServiceEndpoint endpoint) { if (endpoint == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpoint)); } MakeCacheSettingReadOnly(); if (s_cacheSetting == CacheSetting.AlwaysOn) { _endpointTrait = new ServiceEndpointTrait <TChannel>(endpoint, null); InitializeChannelFactoryRef(); } else { _channelFactoryRef = new ChannelFactoryRef <TChannel>(new ChannelFactory <TChannel>(endpoint)); _channelFactoryRef.ChannelFactory.TraceOpenAndClose = false; TryDisableSharing(); } }
public override bool Equals(object obj) { EndpointTrait <TChannel> trait = obj as EndpointTrait <TChannel>; if (trait == null) { return(false); } if (!object.ReferenceEquals(this.callbackInstance, trait.callbackInstance)) { return(false); } if (string.CompareOrdinal(this.endpointConfigurationName, trait.endpointConfigurationName) != 0) { return(false); } if (this.remoteAddress != trait.remoteAddress) { return(false); } return(true); }