question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApplicationService has empty/default data when accessing from non-CMS-routed page

See original GitHub issue

I 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.

image

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tidyuicommented, Nov 6, 2018

Btw, before I have time to get to the bottom of this, try injecting an IApi directly instead! That should do the trick!

Regards

0reactions
tidyuicommented, Nov 7, 2018

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found