Beispiel #1
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));
        }
Beispiel #2
0
        public static TService GetServiceSingleton <TService>(this IRpcConnectionManager connectionManager, RpcConnectionInfo connectionInfo, bool useSyncContext = true) where TService : class
        {
            if (connectionManager == null)
            {
                throw new ArgumentNullException(nameof(connectionManager));
            }

            return(connectionManager.GetServiceSingleton <TService>(connectionInfo, useSyncContext ? SynchronizationContext.Current : null));
        }
Beispiel #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));
        }
Beispiel #4
0
        public static TService GetServiceSingleton <TService>(this IRpcConnectionManager connectionManager, RpcSingletonRef <TService> singletonRef, bool useSyncContext = true) where TService : class
        {
            if (connectionManager == null)
            {
                throw new ArgumentNullException(nameof(connectionManager));
            }

            if (singletonRef == null)
            {
                throw new ArgumentNullException(nameof(singletonRef));
            }

            var connection = singletonRef.ServerConnection;

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

            return(connectionManager.GetServiceSingleton <TService>(connection, useSyncContext ? SynchronizationContext.Current : null));
        }