public IMessageEnvelope ProcessMessage(IMessageEnvelope envelope) { var metadata = envelope.Metadata; var message = connector.GetMessage(envelope); if (message == null) { return(CreateErrorResponse(metadata, new Exception("No message found in the envelope."))); } if (message is ConnectRequest) { return(ProcessConnect(metadata, (ConnectRequest)message)); } if (message is AuthenticateRequest) { return(ProcessAuthenticate(metadata, (AuthenticateRequest)message)); } if (message is QueryExecuteRequest) { return(ProcessQuery(metadata, (QueryExecuteRequest)message)); } if (message is QueryResultPartRequest) { return(ProcessQueryPart(metadata, (QueryResultPartRequest)message)); } if (message is DisposeResultRequest) { return(ProcessDisposeResult(metadata, (DisposeResultRequest)message)); } if (message is LargeObjectCreateRequest) { return(ProcessCreateLargeObject(metadata, (LargeObjectCreateRequest)message)); } if (message is BeginRequest) { return(ProcessBegin(metadata)); } if (message is CommitRequest) { return(ProcessCommit(metadata, (CommitRequest)message)); } if (message is RollbackRequest) { return(ProcessRollback(metadata, (RollbackRequest)message)); } if (message is CloseRequest) { return(ProcessClose(metadata)); } return(CreateErrorResponse(envelope, "Message not supported")); }