public void SetRowKey(DeviceInformation deviceInfo)
 {
     // Use a reverse data schema to keep rows sorted chronologically 
     RowKey = string.Format("{0:D19}_{1}_{2}",
         DateTimeOffset.MaxValue.Ticks - DateTimeOffset.UtcNow.Ticks,
         deviceInfo.Manufacturer,
         deviceInfo.Model);
 }
        private async Task StoreResults(DeviceInformation deviceInfo, Stream results)
        {
            string logName = GenerateUniqueLogName();
            string deviceInfoBlobName = logName + StorageNames.BenchmarkDeviceInfoBlobPrefix;
            string resultsBlobName = logName + StorageNames.BenchmarkResultsBlobPrefix;

            var blobClient = _storageAccount.CreateCloudBlobClient();
            var logsContainer = blobClient.GetContainerReference(StorageNames.BenchmarkLogsContainerName);

            await logsContainer.CreateIfNotExistsAsync();

            // Upload the results first because the device blob is the one triggering the webjob
            var resultsBlob = logsContainer.GetBlockBlobReference(resultsBlobName);
            await resultsBlob.UploadFromStreamAsync(results);

            var deviceInfoBlob = logsContainer.GetBlockBlobReference(deviceInfoBlobName);
            await deviceInfoBlob.UploadTextAsync(JsonConvert.SerializeObject(deviceInfo));
        }
 public BenchmarkTableEntity(DeviceInformation deviceInfo)
 {
     SetRowKey(deviceInfo);
 }