/// <summary> /// This implementation uses Wintellect Azure Table library to overcome the limitation of 32KB for string attributes. /// The ARM template data is now stored as bytes and Wintellect library is used to automatically split and join the byte array based on pre-defined number of splits. /// Refer <see cref="TemplateEntity"/> for implementation details /// </summary> public async Task <TemplateViewModel> GetTemplate(string templateName) { var table = await TableUtil.GetTableReference(Tables.Products); var azTable = new AzureTable(table); var dynamicTemplateEntity = await TemplateEntity.FindAsync(azTable, partitionKey, templateName); var templateViewModel = new TemplateEntity(azTable, dynamicTemplateEntity); return(TemplateEntity.MapToViewModel(templateViewModel)); }
/// <summary> /// This implementation uses Wintellect Azure Table library to overcome the limitation of 32KB for string attributes. /// The ARM template data is now stored as bytes and Wintellect library is used to automatically split and join the byte array based on pre-defined number of splits. /// Refer <see cref="TemplateEntity"/> for implementation details /// </summary> public async Task <TemplateViewModel> SaveTemplate(TemplateViewModel template) { template.PartitionKey = partitionKey; template.ProductImagePath = await SaveProductImageAsBlob(template.ProductImage); template.ProductImage = null; //Null out the base64 data var table = await TableUtil.GetTableReference(Tables.Products); var azTable = new AzureTable(table); var templateEntity = TemplateEntity.MapFromViewModel(template, azTable); var tableResult = await templateEntity.InsertOrReplaceAsync(); var templateViewModel = TemplateEntity.MapToViewModel((TemplateEntity)tableResult.Result); return(templateViewModel); }
/// <summary> /// This implementation uses Wintellect Azure Table library to overcome the limitation of 32KB for string attributes. /// The ARM template data is now stored as bytes and Wintellect library is used to automatically split and join the byte array based on pre-defined number of splits. /// Refer <see cref="TemplateEntity"/> for implementation details /// </summary> public async Task <List <TemplateViewModel> > GetTemplates() { var query = new TableQuery(); query.FilterString = new TableFilterBuilder <TemplateEntity>() .And(te => te.PartitionKey, CompareOp.EQ, partitionKey); var table = await TableUtil.GetTableReference(Tables.Products); var azTable = new AzureTable(table); var dynamicTemplateEntities = table.ExecuteQuery(query); var templateList = new List <TemplateViewModel>(); foreach (var entity in dynamicTemplateEntities) { var templateEntity = new TemplateEntity(azTable, entity); templateList.Add(TemplateEntity.MapToViewModel(templateEntity)); } return(templateList); }