예제 #1
0
 void AfterAccessNotification(TokenCacheNotificationArgs args)
 {
     if (this.HasStateChanged)
     {
         localCache = new TokenEntity(user, this.Serialize(), DateTime.UtcNow);
         repository.InsertOrReplace(localCache);
     }
 }
예제 #2
0
        void BeforeAccessNotification(TokenCacheNotificationArgs args)
        {
            var latestToken = repository.GetAllTokensForUser(user)
                              .OrderByDescending(a => a.LastWriteTime)
                              .FirstOrDefault();

            if (localCache == null || (latestToken != null && localCache.LastWriteTime < latestToken.LastWriteTime))
            {
                localCache = latestToken;
            }

            this.Deserialize(localCache?.CacheToken);
        }
예제 #3
0
        public void InsertOrReplace(TokenEntity tokenEntity)
        {
            var tableOp = TableOperation.InsertOrReplace(tokenEntity);

            cloudTable.Execute(tableOp);
        }
예제 #4
0
        public void Delete(TokenEntity tokenEntity)
        {
            var tableOp = TableOperation.Delete(tokenEntity);

            cloudTable.Execute(tableOp);
        }