OpenConnector() protected method

protected OpenConnector ( ConnectionEndPoint remoteEndPoint, string databaseName ) : void
remoteEndPoint ConnectionEndPoint
databaseName string
return void
示例#1
0
            private IMessageEnvelope ProcessConnect(IDictionary <string, object> metadata, ConnectRequest request)
            {
                Exception       error = null;
                ConnectResponse response;

                try {
                    connector.OpenConnector(request.RemoteEndPoint, request.DatabaseName);
                    if (request.AutoCommit)
                    {
                        connector.SetAutoCommit(request.AutoCommit);
                    }

                    connector.SetIgnoreIdentifiersCase(request.IgnoreIdentifiersCase);
                    connector.SetParameterStyle(request.ParameterStyle);

                    var encryptionData = connector.GetEncryptionData();

                    var serverVersion = connector.Database.Version.ToString(2);
                    response = new ConnectResponse(true, serverVersion, encryptionData != null, encryptionData);
                } catch (Exception ex) {
                    // TODO: Log the error ...
                    error    = ex;
                    response = new ConnectResponse(false, null);
                }

                var envelope = connector.CreateEnvelope(metadata, response);

                if (error != null)
                {
                    envelope.SetError(error);
                }

                return(connector.CreateEnvelope(metadata, response));
            }