Ejemplo n.º 1
0
 /// <summary>
 /// 环绕拦截通知
 /// </summary>
 /// <param name="invocation"></param>
 /// <returns></returns>
 public object Invoke(IMethodInvocation invocation)
 {
     //对OrderRepository进行方法拦截
     if (invocation.Method.Name == "Save")
     {
         OrderRepository orderDAL = (OrderRepository)invocation.Target;
         return(categoryDAL.CheckNo(orderDAL.Order.Category) ? invocation.Proceed() : null);
     }
     else
     {
         return(invocation.Proceed());
     }
 }
Ejemplo n.º 2
0
 public bool CheckNo(Category category)
 {
     return(categoryDAL.CheckNo(category));
 }