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