public TweetTableEntity(Tweet tweet, bool flipId) { PartitionKey = TweetPartitionKey; RowKey = flipId ? string.Format("{0:d19}", long.MaxValue - tweet.Id) : string.Format("{0:d19}", tweet.Id); TweetJson = JsonConvert.SerializeObject(tweet); }
private void UploadTweetToTable(Tweet tweet) { var insertOperation = TableOperation.InsertOrReplace(new TweetTableEntity(tweet, false)); _tweetsTable.Execute(insertOperation); Trace.TraceInformation("Successfully uploaded tweet to tablestorage"); }
private async Task UploadTweetToBlobAsync(Tweet tweet) { CloudBlockBlob tweetBlob = _blobContainer.GetBlockBlobReference(tweet.IdString); using (var ms = new MemoryStream()) { var writer = new StreamWriter(ms); writer.Write(JsonConvert.SerializeObject(tweet)); writer.Flush(); ms.Position = 0; await tweetBlob.UploadFromStreamAsync(ms); } }