IVO.CMS.Web.RenderingSystemContext.RenderBlobAsync C# (CSharp) Method

RenderBlobAsync() public method

public RenderBlobAsync ( IVO.Definition.Models.CanonicalBlobPath path ) : Task>
path IVO.Definition.Models.CanonicalBlobPath
return Task>
        public async Task<Errorable<HtmlFragment>> RenderBlobAsync(CanonicalBlobPath path)
        {
            var mroot = await GetRoot();
            // The most popular error message will be...
            if (!mroot.HasValue) return new ConsistencyError("Either the site is not published or we have no frame of reference on which ");

            // Create a TreeBlobPath to root the blob path in the current root TreeID:
            var tbpath = new TreeBlobPath(mroot.Value, path);

            // Try getting the blob by its path:
            var eblob = await SystemContext.tpsbrepo.GetBlobByTreePath(tbpath);
            if (eblob.HasErrors) return eblob.Errors;
            var blob = eblob.Value.StreamedBlob;

            // Render the blob:
            var efragment = await Engine.RenderBlob(new TreePathStreamedBlob(tbpath, blob));
            if (efragment.HasErrors) return efragment.Errors;

            // Return its output:
            return efragment.Value;
        }
    }