????3??IL???
????????????????????????PostSharp??????????????????????????????????ù?????????
????Postsharp??2.0?汾???????????????AOP??????????????????????汾???????????PostSharp???????????????????????????????????????????????е??????????????AOP??????????????????????????????ò??????£?
??????1??????Postsharp????????????
??????2??????????AOP??????????PostSharp.dll ???dll?????á?
??????3????????????????
????[Serializable]
????public class TestAop : PostSharp.Aspects.OnMethodBoundaryAspect
????{
????//???????????????
????public override void OnException(MethodExecutionArgs args)
????{
????base.OnException(args);
????}
????//??з??????д????
????public override void OnEntry(MethodExecutionArgs args)
????{
????base.OnEntry(args);
????}
????//??з???????д????
????public override void OnExit(MethodExecutionArgs args)
????{
????base.OnExit(args);
????}
????}
????????????TestAop???????????????л?????????????[Serializable]????
??????4???????????????????á?
??????????????????????????????????е???????????????????
[TestAop]public class Impc_TM_PLANT : Ifc_TM_PLANT
{
///
/// ????????÷??????
///
private Ic_TM_PLANTService service { get; set; }
public IList Find()
{
DTO_TM_PLANT otest = null;
otest.NAME_C = "test";
//?????????OnException????
return service.FindAll(); ???????? }????}
???????????????????????????????
[TestAop]
public IList Find()
{
DTO_TM_PLANT otest = null;
otest.NAME_C = "test";
return service.FindAll();
}
????????ио??????????????????????????????????????????????????????????С???????????Postsharp???????????????????????????????????
????4??MVC?????Filter
public class AOPFilterAttribute : ActionFilterAttribute?? IExceptionFilter
{
public void OnException(ExceptionContext filterContext)
{
throw new System.NotImplementedException();
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);
}
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
}
}
??????controller?????????????
????[AOPFilter]
????public JsonResult GetEditModel(string strType)
????{
????var lstRes = new List>();
????var lstResPage = new List();
????//.........todo
????return Json(new { lstDataAttr = lstRes?? PageAttr = lstResPage?? lstJsConnections = lstJsPlumbLines }?? JsonRequestBehavior.AllowGet);
????}
?????????????????GetEditModel(string strType)???????????????OnActionExecuting()??????GetEditModel(string strType)?????????OnActionExecuted()??????????????MVC???????????????????????????????ù???????????????