Setting Microsoft SQL's Context_Info
In this recipe, we will show you how to use Microsoft SQL Server's Context_Info
to provide the current username to your audit triggers.
Getting ready
- Complete the previous recipe, Generating trigger-based auditing
- Download
Ninject.dll
andCommonServiceLocator.NinjectAdapter.dll
from the Ninject project at http://ninject.org - Download
Microsoft.Practices.ServiceLocation.dll
from the Microsoft patterns and practices team available at http://commonservicelocator.codeplex.com/
How to do it…
- Add a reference to
Ninject.dll
,CommonServiceLocator.NinjectAdapter.dll
andMicrosoft.Practices.ServiceLocation.dll
. - Add the following
IAuditColumnSource
implementation:public class CtxAuditColumnSource : IAuditColumnSource { public ...
Get NHibernate 4.x Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.