Deveel.Data.Protocol.ServerConnector.AssertAuthenticated C# (CSharp) Method

AssertAuthenticated() private method

private AssertAuthenticated ( ) : void
return void
        private void AssertAuthenticated()
        {
            if (CurrentState != ConnectorState.Authenticated)
                throw new InvalidOperationException("The connector is not authenticated.");

            if (User == null)
                throw new InvalidOperationException("The connector is authenticated but no user is set.");
        }

Usage Example

Example #1
0
            private IMessageEnvelope ProcessClose(IDictionary <string, object> metadata)
            {
                try {
                    connector.AssertNotDisposed();
                    connector.AssertAuthenticated();

                    connector.CloseConnector();
                    return(connector.CreateEnvelope(metadata, new AcknowledgeResponse(true)));
                } catch (Exception ex) {
                    // TODO: Log the error ...
                    return(CreateErrorResponse(metadata, ex));
                }
            }
All Usage Examples Of Deveel.Data.Protocol.ServerConnector::AssertAuthenticated