I'm playing around with SharpArchitecture and I'm trying to create a simple AuditInterceptor for NHibernate in the Infrastructure layer.
Now, my problem is to make the current request details accessible from within the interceptor. This includes the current user and the date/time at which the server received the active request.
Should I be using some kind of UnitOfWork pattern? If so, what is a good way of making the UnitOfWork object available to the interceptor code?
As far as I have found out the best place to get the current user is:
I had a need to also get the Date/Time of the current request and decided it was best to create a custom
IPrincipal
which had aCurrentDateTime
property and then I set the custom principal either in Global.asaxOnAuthenticated
or in my MVC ActionFilter.