Dev2.Studio.Core.Models.EnvironmentModel.Connect C# (CSharp) Method

Connect() public method

public Connect ( ) : void
return void
        public void Connect()
        {
            if(Connection.IsConnected)
            {
                return;
            }
            if(string.IsNullOrEmpty(Name))
            {
                throw new ArgumentException(string.Format(StringResources.Error_Connect_Failed, StringResources.Error_DSF_Name_Not_Provided));
            }

            Dev2Logger.Log.Debug("Attempting to connect to [ " + Connection.AppServerUri + " ] ");
            Connection.Connect(ID);
        }

Same methods

EnvironmentModel::Connect ( IEnvironmentModel other ) : void

Usage Example

 public void GivenIHaveAServer(string serverName)
 {
     if(serverName != "localhost")
     {
         var environmentModel = new EnvironmentModel(Guid.NewGuid(), new ServerProxy(new Uri(string.Format("http://{0}:3142", serverName))));
         EnvironmentRepository.Instance.Save(environmentModel);
         environmentModel.Connect();
     }
 }
All Usage Examples Of Dev2.Studio.Core.Models.EnvironmentModel::Connect