public async Task <Asset> GetById(string id) { var rowKey = BlockEntity.GenerateRowKey(id); var partitionKey = BlockEntity.GeneratePartiteonKey(); var assetRecord = await _assetTable.GetDataAsync(partitionKey, rowKey); if (assetRecord == null) { return(null); } return((Asset)JsonConvert.DeserializeObject(assetRecord.JsonData)); }
public async Task <Block> GetById(string id) { var rowKey = BlockEntity.GenerateRowKey(id); var partitionKey = BlockEntity.GeneratePartiteonKey(); var blockRecord = await _blockTable.GetDataAsync(partitionKey, rowKey); if (blockRecord == null) { return(null); } var blockJsonData = await _blobStorage.GetAsync(BlobContainer, blockRecord.Hash); var blockJson = Encoding.UTF8.GetString(blockJsonData.ToBytes()); var block = JsonConvert.DeserializeObject <Block>(blockJson); _importedMap[id] = blockRecord.IsImported; return(block); }