When implementing IDbCommandInterceptor, I can get access to the SQL command that has been created for the command/query. Is it also possible to get access to the actual entity object that is being persisted/retrieved whilst in the implemented methods?
Here is some fantasy code to demonstrate what I would like to do:
public class WidgetInterceptor : IDbCommandInterceptor
{
public void NonQueryExecuting(System.Data.Common.DbCommand command, DbCommandInterceptionContext<int> interceptionContext)
{
var widget = interceptionContext.Entity as Widget;
if(widget != null)
{
//Perform tasks on widget before it is saved...
}
}
}