For a WCF project I'm working on, I need to implement some kind of audit log for the entities we're persisting. Basically the audit trail will consist of 4 mandatory fields
- CreatedDateTime
- CreatedUserID
- UpdatedDateTime
- UpdatedUserID
I'm trying to implement this through nHibernate Event Listeners in my DataAccess layer as I think this should not be in the domain layer. So far, I've got the DateTime stuff working as expected, but haven't been able to figure out how to retrieve the userID in the event listener. Ideally, I would like to have the user id as some sort of custom data attached to the nHibernate session object.
Any suggestion is greatly appreciated.