protected void Open() { if (_state != FbServiceState.Closed) { throw new InvalidOperationException("Service already Open."); } if (_csManager.UserID == null || _csManager.UserID.Length == 0) { throw new InvalidOperationException("No user name was specified."); } if (_csManager.Password == null || _csManager.Password.Length == 0) { throw new InvalidOperationException("No user password was specified."); } try { if (_svc == null) { // New instance for Service handler _svc = ClientFactory.CreateServiceManager(_csManager); } // Initialize Services API _svc.Attach(BuildSpb(), _csManager.DataSource, _csManager.Port, _serviceName); _state = FbServiceState.Open; } catch (Exception ex) { throw new FbException(ex.Message, ex); } }
protected void Open() { if (State != FbServiceState.Closed) { throw new InvalidOperationException("Service already Open."); } if (string.IsNullOrEmpty(_csManager.UserID)) { throw new InvalidOperationException("No user name was specified."); } if (string.IsNullOrEmpty(_csManager.Password)) { throw new InvalidOperationException("No user password was specified."); } try { if (_svc == null) { _svc = ClientFactory.CreateServiceManager(_csManager); } _svc.Attach(BuildSpb(), _csManager.DataSource, _csManager.Port, ServiceName); State = FbServiceState.Open; } catch (Exception ex) { throw new FbException(ex.Message, ex); } }