Contribute to Docs Contribute to Docs

Model Loader

The Model Loader is part of the package Piranha.AspNetCore and is intended to be used when building integrated web applications with ASP.NET.

The Model Loader is a scoped service that simplifies model loading for Pages & Posts for the current request. It has support for loading unpublished content and drafts if the current user has access to it. It can be used both from your .cshtml views or pages, or from your backend Controllers.

Registering The Service

The Model Loader should be added in ConfigureServices by calling the extension method:

services.AddPiranhaApplication();

Methods

GetPage
Task<T> GetPage<T>(Guid id, ClaimsPrincipal user, bool draft = false) where T : PageBase;