public TService GetServiceInstance <TService>(RpcObjectRef serviceRef, SynchronizationContext?syncContext) where TService : class
        {
            if (serviceRef == null)
            {
                throw new ArgumentNullException(nameof(serviceRef));
            }

            var connection = serviceRef.ServerConnection;

            if (connection == null)
            {
                throw new ArgumentException("ServiceRef connection not initialized.", nameof(serviceRef));
            }

            var serverConnection = this.GetServerConnection(connection);

            return(serverConnection.GetServiceInstance <TService>(serviceRef.ObjectId, serviceRef.ImplementedServices, syncContext));
        }
예제 #2
0
        public static TService GetServiceInstance <TService>(this IRpcConnectionManager connectionManager, RpcObjectRef <TService> serviceRef, bool useSyncContext = true) where TService : class
        {
            if (connectionManager == null)
            {
                throw new ArgumentNullException(nameof(connectionManager));
            }

            return(connectionManager.GetServiceInstance <TService>(serviceRef, useSyncContext ? SynchronizationContext.Current : null));
        }
예제 #3
0
        public static TService GetServiceInstance <TService>(this IRpcConnectionManager connectionManager, RpcObjectRef serviceRef, SynchronizationContext syncContext) where TService : class
        {
            if (connectionManager == null)
            {
                throw new ArgumentNullException(nameof(connectionManager));
            }

            return(connectionManager.GetServiceInstance <TService>(serviceRef, syncContext));
        }