public void Execute()
        {
            var expired = _DateTimeProvider.Now() - TimeSpan.FromDays(_TokenFirstWorkflowConfig.WorkflowWriteWindowDurationMinutes);

            _DbContextProvider.BeginTransaction();
            var q = _DbContextProvider.Current.TokenFirstWorkflows
                    .Where(x => x.State == TokenFirstWorkflowState.Receiving && x.ReceivingStarted < expired);

            _DbContextProvider.Current.TokenFirstWorkflows.RemoveRange(q);
            _DbContextProvider.Current.SaveChanges();
            _DbContextProvider.SaveAndCommit();
        }
Example #2
0
        public void Execute()
        {
            var expired = _DateTimeProvider.Now() - TimeSpan.FromDays(_TokenFirstWorkflowConfig.WorkflowTokenTtlDays);

            _DbContextProvider.BeginTransaction();
            var q = _DbContextProvider.Current.TokenFirstWorkflows
                    .Where(x => x.State == TokenFirstWorkflowState.Unauthorised && x.Created < expired);

            _DbContextProvider.Current.TokenFirstWorkflows.RemoveRange(q);
            _DbContextProvider.Current.SaveChanges();
            _DbContextProvider.SaveAndCommit();
        }