I think doing this at the repository level is much better. Mainly because in the future you may want to add some method of access to your repository that does not go through MVC (for example, WCF interface for data).
So, the question is, how do you address the downsides that you indicated about its implementation at the NHibernate level?
Filtering useful objects is quite simple. I would probably do this with a custom attribute of an entity type. You can mark objects that you want to track, or those that you do not have; whichever is easier.
Finding out what is really meant for the controller is harder. I am going to dispute that you can "get an HttpContext"; I do not think it is a good idea to do this in the repository, because there is a separation of problems. The repository should not be dependent on the Internet. One method is to create custom methods in the repository for actions that you want to track in different ways; this is especially attractive if there are other aspects of these changes that behave differently, for example, different security. Another method is to study changes by comparing old and new versions of objects and obtain the actual nature of the change. The third method is not to try to get the nature of the change, but simply to store the version before and after in the journal so that the person who reads the journal can figure it out for themselves.
source share