The Model Loader is part of the package
Piranha.AspNetCore
and is intended to be used when building integrated web applications withASP.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
.
The Model Loader should be added in ConfigureServices
by calling the extension method:
services.AddPiranhaApplication();
Task<T> GetPage<T>(Guid id, ClaimsPrincipal user, bool draft = false) where T : PageBase;