I have a website where I want to have a partial view on the page that contains a Singleton service.
I am trying to do this with Razor Pages, and have tried Partial Views and ViewComponents, but haven't gotten the desired experience, probably because I am not implementing correctly.
Here is what I would like to accomplish.
- Singleton Service that is shared between the partial view and all other views in app (this login panel where each page needs to access the user name supplied by the service.
- Based on state of the service, doing a common process (custom business logic) on each view (if the user is of a certain role, change UI and log differenly)
- Not having to wire up DI constructors on each view (can I use a base pagemodel)
I can supply some code if needed but I wanted to see if what I am trying to do is allowed with Razor Pages.