Beispiel #1
0
 void AfterAccessNotification(TokenCacheNotificationArgs args)
 {
     if (this.HasStateChanged)
     {
         localCache = new TokenEntity(user, this.Serialize(), DateTime.UtcNow);
         repository.InsertOrReplace(localCache);
     }
 }
Beispiel #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);
        }
Beispiel #3
0
        public void InsertOrReplace(TokenEntity tokenEntity)
        {
            var tableOp = TableOperation.InsertOrReplace(tokenEntity);

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

            cloudTable.Execute(tableOp);
        }