ApplicationService has empty/default data when accessing from non-CMS-routed page
See original GitHub issueI am using Piranha as the CMS for a pre-existing site (I used https://github.com/PiranhaCMS/piranha.core.examples as a seed for implementing it — thanks for making that!). On custom pages served through my own routing rather than the CmsController
’s routes, trying to use Piranha.AspNetCore.Services.ApplicationService
does not work properly. The data its properties contain does not accurately reflect the data in the CMS. For instance, my Piranha database contains a blog archive with three blog posts, but the Api
property of the app service is null.
I believe the service is properly configured in Startup.cs
and my _ViewImports.cs
is correct. Would you mind taking a look at my repo and seeing what I’m doing wrong? My goal is to have a “latest post” section on my Index.cshtml home page that displays some info about the most recently added blog post. Here’s the link to the private repo, which I’ve just added you as a collaborator on: https://github.com/stamminator/hps-core
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Btw, before I have time to get to the bottom of this, try injecting an IApi directly instead! That should do the trick!
Regards
That’s no problem! I can probably reproduce it in a isolated project, and if I can’t you can look at mine to compare!