コード例 #1
0
        private static ChannelFactoryRef <TChannel> CreateChannelFactoryRef(EndpointTrait <TChannel> endpointTrait)
        {
            ChannelFactory <TChannel> channelFactory = endpointTrait.CreateChannelFactory();

            channelFactory.TraceOpenAndClose = false;
            return(new ChannelFactoryRef <TChannel>(channelFactory));
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public int GetHashCode(EndpointTrait <TChannel> obj)
 {
     if (obj == null)
     {
         return(0);
     }
     return(obj.GetHashCode());
 }
コード例 #4
0
 protected ClientBase()
 {
     this.canShareFactory = true;
     this.syncRoot        = new object();
     this.finalizeLock    = new object();
     this.endpointTrait   = new EndpointTrait <TChannel>("*", null, null);
     this.InitializeChannelFactoryRef();
 }
コード例 #5
0
        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));
        }
コード例 #6
0
 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);
 }
コード例 #7
0
 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();
 }
コード例 #8
0
 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();
 }
コード例 #9
0
 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();
 }
コード例 #10
0
        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();
            }
        }
コード例 #11
0
        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);
        }