Пример #1
0
        public async Task ViewAWidget(StockCode stockCode)
        {
            // ...
            var widget = await _widgetQueries.Get(stockCode);

            // ...
        }
Пример #2
0
        public async Task <Widget> Get(StockCode stockCode)
        {
            var operation = TableOperation.Retrieve <WidgetEntity>(stockCode.Category.ToLowerInvariant(),
                                                                   stockCode.Id.ToLowerInvariant());
            TableResult result = await _cloudTable.ExecuteAsync(operation);

            var entity = result.Result as WidgetEntity;

            return(new Widget
            {
                StockCode = new StockCode {
                    Category = entity.PartitionKey, Id = entity.RowKey
                },
                Description = entity.Description
            });
        }