public override string UpdateDatabaseRecord(DatabaseRecord record, long etag)
        {
            if (Watcher == null)
            {
                return(null);
            }

            if (Watcher.TaskId == 0)
            {
                Watcher.TaskId = etag;
            }
            else
            {
                //modified watcher, remove the old one
                ExternalReplication.RemoveWatcher(record.ExternalReplications, Watcher.TaskId);
            }
            //this covers the case of a new watcher and edit of an old watcher
            if (string.IsNullOrEmpty(Watcher.Name))
            {
                Watcher.Name = Watcher.GetDefaultTaskName();
            }
            record.EnsureTaskNameIsNotUsed(Watcher.Name);
            record.ExternalReplications.Add(Watcher);
            return(null);
        }
Exemplo n.º 2
0
        public override string UpdateDatabaseRecord(DatabaseRecord record, long etag)
        {
            Debug.Assert(TaskId != 0);

            switch (TaskType)
            {
            case OngoingTaskType.Replication:
                ExternalReplication.RemoveWatcher(ref record.ExternalReplication, TaskId);
                break;

            case OngoingTaskType.Backup:
                record.DeletePeriodicBackupConfiguration(TaskId);
                return(TaskId.ToString());

            case OngoingTaskType.SqlEtl:
                var sqlEtl = record.SqlEtls?.Find(x => x.TaskId == TaskId);
                if (sqlEtl != null)
                {
                    record.SqlEtls.Remove(sqlEtl);
                }
                break;

            case OngoingTaskType.RavenEtl:
                var ravenEtl = record.RavenEtls?.Find(x => x.TaskId == TaskId);
                if (ravenEtl != null)
                {
                    record.RavenEtls.Remove(ravenEtl);
                }
                break;
            }

            return(null);
        }
        public override string UpdateDatabaseRecord(DatabaseRecord record, long etag)
        {
            if (Watcher == null)
            {
                return(null);
            }

            if (Watcher.TaskId == 0)
            {
                Watcher.TaskId = etag;
            }
            else
            {
                //modified watcher, remove the old one
                ExternalReplication.RemoveWatcher(record.ExternalReplications, Watcher.TaskId);
            }

            record.ExternalReplications.Add(Watcher);
            return(null);
        }
Exemplo n.º 4
0
        public override string UpdateDatabaseRecord(DatabaseRecord record, long etag)
        {
            if (Watcher == null)
            {
                return(null);
            }

            ExternalReplication.EnsureUniqueDbAndConnectionString(record.ExternalReplication, Watcher);

            if (Watcher.TaskId == 0)
            {
                Watcher.TaskId = etag;
            }
            else
            {
                //modified watcher, remove the old one
                ExternalReplication.RemoveWatcher(ref record.ExternalReplication, Watcher.TaskId);
            }

            record.ExternalReplication.Add(Watcher);
            return(null);
        }