Beispiel #1
0
        private DbProviderFactory GetDbProviderFactory(SqlReplicationConfiguration configuration)
        {
            DbProviderFactory providerFactory;

            try
            {
                providerFactory = DbProviderFactories.GetFactory(_predefinedSqlConnection.FactoryName);
            }
            catch (Exception e)
            {
                if (_logger.IsInfoEnabled)
                {
                    _logger.Info($"Could not find provider factory {_predefinedSqlConnection.FactoryName} to replicate to sql for {configuration.Name}, ignoring", e);
                }

                _database.Alerts.AddAlert(new Alert
                {
                    Type      = AlertType.SqlReplicationProviderError,
                    CreatedAt = SystemTime.UtcNow,
                    Message   = "Sql Replication could not find factory provider",
                    Key       = configuration.Name,
                    Content   = new ExceptionAlertContent
                    {
                        Message   = $"Could not find factory provider {_predefinedSqlConnection.FactoryName} to replicate to sql for {configuration.Name}, ignoring",
                        Exception = e.ToString()
                    },
                    Severity = AlertSeverity.Error
                });

                throw;
            }
            return(providerFactory);
        }
 public SqlReplicationPatchDocument(DocumentDatabase database, DocumentsOperationContext context, SqlReplicationScriptResult scriptResult, SqlReplicationConfiguration config, string documentKey)
     : base(database)
 {
     _context          = context;
     this.scriptResult = scriptResult;
     this.config       = config;
     this._documentKey = documentKey;
 }
Beispiel #3
0
        public SqlReplication(DocumentDatabase database, SqlReplicationConfiguration configuration)
        {
            _logger   = LoggingSource.Instance.GetLogger(database.Name, GetType().FullName);
            _database = database;
            _cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_database.DatabaseShutdown);
            WaitForChanges           = new ManualResetEventSlim();

            Configuration          = configuration;
            Statistics             = new SqlReplicationStatistics(configuration.Name);
            MetricsCountersManager = new SqlReplicationMetricsCountersManager();
        }