예제 #1
0
        public async Task <IToken> GetAsync(string tokenId)
        {
            var pk = TokenEntity.GeneratePartitionKey();
            var rk = TokenEntity.GenerateRowKey(tokenId);

            return(await _tableStorage.GetDataAsync(pk, rk));
        }
예제 #2
0
        public async Task SaveTokenAsync(IToken token)
        {
            var ts = token as TokenEntity;

            if (ts == null)
            {
                ts = (TokenEntity) await GetAsync(token.RowKey) ?? new TokenEntity();

                ts.ETag       = token.ETag;
                ts.AccessList = token.AccessList;
                ts.IpList     = token.IpList;
            }
            ts.PartitionKey = TokenEntity.GeneratePartitionKey();
            ts.RowKey       = token.RowKey;
            await _tableStorage.InsertOrMergeAsync(ts);
        }
예제 #3
0
 public async Task RemoveTokenAsync(string tokenId)
 {
     var pk = TokenEntity.GeneratePartitionKey();
     await _tableStorage.DeleteAsync(pk, tokenId);
 }
예제 #4
0
        public async Task <IEnumerable <IToken> > GetAllAsync()
        {
            var pk = TokenEntity.GeneratePartitionKey();

            return(await _tableStorage.GetDataAsync(pk));
        }