コード例 #1
0
ファイル: CipherRepository.cs プロジェクト: ebell451/core
 public IQueryable <User> GetBumpedAccountsByCipherId(Cipher cipher)
 {
     using (var scope = ServiceScopeFactory.CreateScope())
     {
         var dbContext = GetDatabaseContext(scope);
         var query     = new UserBumpAccountRevisionDateByCipherIdQuery(cipher);
         return(query.Run(dbContext));
     }
 }
コード例 #2
0
        protected async Task UserBumpAccountRevisionDateByCipherId(IEnumerable <Cipher> ciphers)
        {
            using (var scope = ServiceScopeFactory.CreateScope())
            {
                foreach (var cipher in ciphers)
                {
                    var dbContext = GetDatabaseContext(scope);
                    var query     = new UserBumpAccountRevisionDateByCipherIdQuery(cipher);
                    var users     = query.Run(dbContext);

                    await users.ForEachAsync(e =>
                    {
                        dbContext.Attach(e);
                        e.RevisionDate = DateTime.UtcNow;
                    });

                    await dbContext.SaveChangesAsync();
                }
            }
        }