コード例 #1
0
 public static void RenderTemplateWithContentToBlob(CloudBlob template, CloudBlob renderTarget, InformationSource setAsDefaultSource = null)
 {
     InformationSourceCollection sources = renderTarget.GetBlobInformationSources();
     if(sources == null)
     {
         sources = CreateDefaultSources(template);
     }
     if (setAsDefaultSource != null)
     {
         sources.SetDefaultSource(setAsDefaultSource);
     }
     string templateContent = template.DownloadText();
     List<ContentItem> existingRoots = GetExistingRoots(sources);
     string renderResult = RenderTemplateWithContentRoots(templateContent, existingRoots);
     bool rerenderRequired = UpdateMismatchedRootsToSources(sources, existingRoots, renderTarget);
     renderTarget.SetBlobInformationSources(sources);
     renderTarget.UploadBlobText(renderResult, StorageSupport.InformationType_RenderedWebPage);
     if(rerenderRequired)
     {
         RenderTemplateWithContentToBlob(template, renderTarget);
     } else
     {
         sources.SubscribeTargetToSourceChanges(renderTarget);
     }
 }