/// <summary>
        ///		Initializes a new instance of the <see cref="ClientTransport"/> class.
        /// </summary>
        /// <param name="manager">The manager which will manage this instance.</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="manager"/> is <c>null</c>.
        /// </exception>
        protected ClientTransport(ClientTransportManager manager)
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            Contract.EndContractBlock();

            this._manager                  = manager;
            this._pendingRequestTable      = new ConcurrentDictionary <int, Action <ClientResponseContext, Exception, bool> >();
            this._pendingNotificationTable = new ConcurrentDictionary <long, Action <Exception, bool> >();

            this._afterSerializationFilters =
                new ReadOnlyCollection <MessageFilter <ClientRequestContext> >(
                    manager.Configuration.FilterProviders
                    .OfType <MessageFilterProvider <ClientRequestContext> >()
                    .Select(provider => provider.GetFilter(MessageFilteringLocation.AfterSerialization))
                    .Where(filter => filter != null)
                    .ToArray()
                    );
            this._beforeDeserializationFilters =
                new ReadOnlyCollection <MessageFilter <ClientResponseContext> >(
                    manager.Configuration.FilterProviders
                    .OfType <MessageFilterProvider <ClientResponseContext> >()
                    .Select(provider => provider.GetFilter(MessageFilteringLocation.BeforeDeserialization))
                    .Where(filter => filter != null)
                    .Reverse()
                    .ToArray()
                    );
        }
 /// <summary>
 ///		Initializes a new instance of the <see cref="NullClientTransport"/> class.
 /// </summary>
 /// <param name="manager">The manager which will manage this instance.</param>
 /// <exception cref="ArgumentNullException">
 ///		<paramref name="manager"/> is <c>null</c>.
 /// </exception>
 public NullClientTransport(ClientTransportManager <NullClientTransport> manager) : base(manager)
 {
 }
Пример #3
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcClient"/> class.
		/// </summary>
		/// <param name="targetEndPoint">
		///		<see cref="EndPoint"/> for the target.
		/// </param>
		/// <param name="configuration">
		///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
		/// </param>
		/// <param name="serializationContext">
		///		A <see cref="SerializationContext"/> to hold serializers.
		///	</param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="targetEndPoint"/> is <c>null</c>.
		/// </exception>
		public RpcClient( EndPoint targetEndPoint, RpcClientConfiguration configuration, SerializationContext serializationContext )
		{
			if ( targetEndPoint == null )
			{
				throw new ArgumentNullException( "targetEndPoint" );
			}

			Contract.EndContractBlock();

			var safeConfiguration = configuration ?? RpcClientConfiguration.Default;

			this._transportManager = safeConfiguration.TransportManagerProvider( safeConfiguration );
			this._serializationContext = serializationContext ?? new SerializationContext();
			Interlocked.Exchange( ref this._connectTask, this._transportManager.ConnectAsync( targetEndPoint ) );
		}
Пример #4
0
		/// <summary>
		///		Initializes a new instance of the <see cref="NullClientTransport"/> class.
		/// </summary>
		/// <param name="manager">The manager which will manage this instance.</param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="manager"/> is <c>null</c>.
		/// </exception>
		public NullClientTransport( ClientTransportManager<NullClientTransport> manager ) : base( manager ) { }