Dev2.Network.ServerProxy.Connect C# (CSharp) Метод

Connect() публичный Метод

public Connect ( System.Guid id ) : void
id System.Guid
Результат void
        public void Connect(Guid id)
        {
            try
            {
                _wrappedConnection.Connect(_wrappedConnection.ID);
           
            }
             catch( FallbackException)
            {
                Dev2Logger.Log.Info("Falling Back to previous signal r client");
                var name = _wrappedConnection.DisplayName;
                
                if (AuthenticationType == AuthenticationType.User)
                {
                    _wrappedConnection = new ServerProxyWithChunking(_wrappedConnection.WebServerUri.ToString(),UserName,Password)
                    {
                        DisplayName = name,
                    };
                }
                else
                {
                    _wrappedConnection = new ServerProxyWithChunking(_wrappedConnection.WebServerUri) { DisplayName = name };
                }
                SetupPassthroughEvents();
                _wrappedConnection.Connect(_wrappedConnection.ID);
                _wrappedConnection.DisplayName = name;
            }
            catch (Exception err)
            {
                Dev2Logger.Log.Error(err);
                throw;
            }
        }
        public Guid ID { get { return _wrappedConnection.ID; } }

Usage Example

Пример #1
0
 public static string ExecuteServiceOnLocalhostUsingProxy(string serviceName, Dictionary<string,string> payloadArguments)
 {
     CommunicationControllerFactory fact = new CommunicationControllerFactory();
     var comm = fact.CreateController(serviceName);
     var prx = new ServerProxy("http://localhost:3142", CredentialCache.DefaultNetworkCredentials, new TestAsyncWorker());
     prx.Connect(Guid.NewGuid());
     foreach (var payloadArgument in payloadArguments)
     {
         comm.AddPayloadArgument(payloadArgument.Key, payloadArgument.Value);
     }
     if(comm != null)
     {
         var messageToExecute = comm.ExecuteCommand<ExecuteMessage>(prx, Guid.Empty);
         if(messageToExecute != null)
         {
             var responseMessage = messageToExecute.Message;
             if(responseMessage != null)
             {
                 var actual = responseMessage.ToString();
                 return actual;
             }
             return "Error: response message empty!";
         }
         return "Error: message to send to localhost server could not be generated.";
     }
     return "Error: localhost server controller could not be created.";
 }
All Usage Examples Of Dev2.Network.ServerProxy::Connect