static async Task Main(string[] args) { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddUserSecrets <Program>() .Build() .Get <AppSettings>(); var sampleInfo = ObjectInfoTableEntity.GenerateSample(config.Count, config.Revisions).ToList(); await TableStorageExample.Execute(config.StorageAccount, config.Name + RandomValueGen.GetRandomAlphaString(8), sampleInfo); await BlobStorageExample.Execute(config.StorageAccount, config.Name + RandomValueGen.GetRandomAlphaString(8), sampleInfo); Console.WriteLine("Done!"); }
internal static IEnumerable <ObjectInfoTableEntity> GenerateSample(int count, int revisions) { for (int i = 0; i < count; i++) { ObjectInfoTableEntity last = null; for (int revision = 0; revision < RandomValueGen.GetRandomInt(1, revisions); revision++) { if (revision == 0) { var obj = new ObjectInfoTableEntity(); obj.CustomerId = Guid.NewGuid().ToString(); obj.O365Id = Guid.NewGuid().ToString(); obj.Created = RandomValueGen.GetRandomUtcDate(DateTime.UtcNow.AddYears(-5), DateTime.UtcNow); obj.Removed = RandomValueGen.GetRandomUtcDate(obj.Created, DateTime.UtcNow); obj.PartitionKey = $"{obj.CustomerId}|{obj.O365Id}".MD5Hash(); obj.RowKey = obj.Created.ToString("s"); last = obj; yield return(obj); } else { var obj = new ObjectInfoTableEntity(); obj.CustomerId = last.CustomerId; obj.O365Id = last.O365Id; obj.Created = RandomValueGen.GetRandomUtcDate(last.Created, DateTime.UtcNow); obj.Removed = RandomValueGen.GetRandomUtcDate(obj.Created, DateTime.UtcNow); obj.PartitionKey = $"{obj.CustomerId}|{obj.O365Id}".MD5Hash(); obj.RowKey = obj.Created.ToString("s"); last = obj; yield return(obj); } } } }