public async Task WriteAssetsOwnersDataAsync(IAssetsOwners assetOwnersData) { var key = Guid.NewGuid().ToString(); var bytes = assetOwnersData.ToJson().ToUtf8ByteArray(); await _azureBlob.SaveBlobAsync(BlobContainer, key, bytes); await _tableStorage.InsertOrReplaceAsync(AssetsOwnersEntity.CreateNew(assetOwnersData, key)); }
public async Task <IAssetsOwners> GetAssetsOwnersDataAsync(string assetId) { var rowKey = AssetsOwnersEntity.GenerateRowKey(assetId); var partiteonKey = AssetsOwnersEntity.GeneratePartiteonKey(); var assetData = await _tableStorage.GetDataAsync(partiteonKey, rowKey); if (assetData == null) { return(null); } var blobAssetData = await _azureBlob.GetAsync(BlobContainer, assetData.BlobId); if (blobAssetData == null) { return(null); } var jsonStr = Encoding.UTF8.GetString(blobAssetData.ToBytes()); return(JsonConvert.DeserializeObject <DeserializeAssetsOwner>(jsonStr)); }