Ejemplo n.º 1
0
        public static async Task <List <EmojiEntity> > GetAllEmojis(string partitionKey = "")
        {
            var emojiTable = EmojiTable.Get();
            // Base query to get all entitys
            var emojiQuery = new TableQuery <EmojiEntity>();

            if (!string.IsNullOrEmpty(partitionKey))
            {
                emojiQuery = emojiQuery.Where(
                    TableQuery.GenerateFilterCondition(
                        nameof(TableEntity.PartitionKey),
                        QueryComparisons.Equal,
                        partitionKey));
            }

            var emojiList = new List <EmojiEntity>();
            // Initialize continuation token to start from the beginning of the table.
            var continuationToken = default(TableContinuationToken);

            do
            {
                // Retrieve a segment (1000 entities)
                var tableQueryResult =
                    await emojiTable.ExecuteQuerySegmentedAsync(emojiQuery, continuationToken);

                // Assign the new continuation token to tell the service where to
                // continue on the next iteration (or null if it has reached the end)
                continuationToken = tableQueryResult.ContinuationToken;

                emojiList.AddRange(tableQueryResult.Results);
            } while (continuationToken != null);

            return(emojiList);
        }
Ejemplo n.º 2
0
        public static async Task <EmojiImageEntity> GetEmojiImg(string partitionKey, string rowKey)
        {
            var emojiTable        = EmojiTable.GetImg();
            var retrieveOperation = TableOperation.Retrieve <EmojiImageEntity>(partitionKey, rowKey);
            var result            = await emojiTable.ExecuteAsync(retrieveOperation);

            return(result.Result as EmojiImageEntity);
        }