There are various ways you could achieve this. In your case, probably the easiest way is to implement a
class and its
method, which receives a context argument, providing access to the content item being rendered. Depending on your requirements, you may want to check for the display type the content is being
rendered, since multiple content items might be rendered on the screen (e.g. a list of comments together with the blog post).
What you could then try is have your ContentHandler class implement
, and store the content item in a private field, and access it from your
method, from which you then access the private field pointing to the content item.
This obviously only works if "BuildDisplay" is invoked before "GetNotifications". If that's not the case, then there is another way to find out the current content item by checking the currently requested route and see if it maps to a content
item (and if it does, use the route values to load the content item). I wrote a post about this here:
. I essentially implemented a service that you can inject anywhere to get the current content item.