Ejemplo n.º 1
0
 public void UpdateProgress(string name, ProcessedCommitsCount processedCommits)
 {
     using (var db = _db.Create())
     {
         db.Update <BatchProgress>().Set(d => d.Skip, processedCommits.Value)
         .Where(d => d.Name == name).Execute();
     }
 }
Ejemplo n.º 2
0
        public CommittedEvents GetNextBatch(MigrationConfig config, ProcessedCommitsCount count)
        {
            IEnumerable <Commit> all = _commits;

            if (!config.TenantId.IsNullOrEmpty())
            {
                all = all.Where(d => d.TenantId == config.TenantId);
            }
            all = all.OrderBy(d => d.Timestamp);
            return(new CommittedEvents(all.ToArray()));
        }
Ejemplo n.º 3
0
        public CommittedEvents GetNextBatch(MigrationConfig config, ProcessedCommitsCount count)
        {
            using (var db = _db.Create())
            {
                var all = db.QueryAs(q => q
                                     .FromAnonymous(new { Id = 1, TenantId = "", EntityId = Guid.Empty },
                                                    new TableName(CommitsTable, Schema)).Where(d => true)

                                     .AndIf(() => !config.TenantId.IsNullOrEmpty(), d => d.TenantId == config.TenantId)
                                     .OrderBy(d => d.Id)
                                     .Limit(config.BatchSize, count.Value)
                                     .SelectAll(useAsterisk: true).MapTo <Commit>()
                                     );
                return(new CommittedEvents(all.ToArray()));
            }
        }
Ejemplo n.º 4
0
 public void UpdateProgress(string name, ProcessedCommitsCount processedCommits)
 {
     _batch[name] = processedCommits;
 }