public class SoftDeleteInterceptor : IDbCommandTreeInterceptor
{
public void TreeCreated(DbCommandTreeInterceptionContext interceptionContext)
{
if (interceptionContext.OriginalResult.DataSpace!= DataSpace.SSpace)
{
return;
}
var tree = interceptionContext.Result as DbQueryCommandTree;
if (tree == null)
{
return;
}
var newQuery = tree.Query.Accept(new SoftDeleteQueryVisitor());
interceptionContext.Result = new DbQueryCommandTree(
tree.MetadataWorkspace,
tree.DataSpace,
newQuery);
}
}