Advertisement
bord86

SoftDeleteInterceptor

Jan 26th, 2015
1,810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1.  public class SoftDeleteInterceptor : IDbCommandTreeInterceptor
  2.     {
  3.         public void TreeCreated(DbCommandTreeInterceptionContext interceptionContext)
  4.         {
  5.             if (interceptionContext.OriginalResult.DataSpace!= DataSpace.SSpace)
  6.             {
  7.                 return;
  8.             }
  9.  
  10.             var tree = interceptionContext.Result as DbQueryCommandTree;
  11.  
  12.             if (tree == null)
  13.             {
  14.                 return;
  15.             }
  16.  
  17.             var newQuery = tree.Query.Accept(new SoftDeleteQueryVisitor());
  18.  
  19.             interceptionContext.Result = new DbQueryCommandTree(
  20.                 tree.MetadataWorkspace,
  21.                 tree.DataSpace,
  22.                 newQuery);
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement