We have several events that should trigger a notification to the user.
Everytime someone comments on their wall.
Everytime they win a trophy.
Etc.
So notifications are stored in the database but not really related to any other model. just a html string, really.
Is there a recommended way to handling this other than the obvious “in your controller right after the creation of the comment or trophy or whatever create a notification as well” angle?
You could create an ActionFilter to do that checking for you. ActionFilters are AOP-esque ways to do things before/after actions execute. The classical example is logging: Lets say you want to log before/after every action, but writing Log(); everywhere isn’t very DRY. So you can create a logging actionfilter. See here for a good example.