Beispiel #1
0
        public IDbConnection OpenConnection(string databaseName, string serverName)
        {
            var connectionString = string.Format(rawConnectionString,
                                                 !string.IsNullOrEmpty(databaseName) ? databaseName : string.Empty,
                                                 !string.IsNullOrEmpty(readServer) ? readServer : string.Empty);
            var connection = builder.Build(connectionString);

            connection.Open();
            return(connection);
        }
Beispiel #2
0
 public bool Start()
 {
     _subscriber?.Close();
     _subscriber                       = _subscriberBuilder.Build(false);
     _subscriber.Connected            += _connection_Connected;
     _subscriber.Disconnected         += _connection_Disconnected;
     _subscriber.ErrorOccurred        += _connection_ErrorOccurred;
     _subscriber.Closed               += _connection_Closed;
     _subscriber.Reconnecting         += _connection_Reconnecting;
     _subscriber.AuthenticationFailed += _connection_AuthenticationFailed;
     _subscriber.ConnectAsync().Wait();
     Subscribe().Wait();
     return(true);
 }