AOP

通过AOP实现现日志

//注册ReZero.Api
builder.Services.AddReZeroServices(api =>
{ 
   var apiObj = new SuperAPIOptions();  
   ....省略....
          
   //只看这一行
   apiObj.InterfaceOptions = new InterfaceOptions()
   {
       SuperApiAop=new MyAop()
   };
  
   api.EnableSuperApi(apiObj); 
 
}); 

public class MyAop : DefaultSuperApiAop
{
    public override Task OnExecutingAsync(InterfaceContext context)
    {
        return base.OnExecutingAsync(context);
    }

    public override Task OnExecutedAsync(InterfaceContext context)
    {
        return base.OnExecutedAsync(context);
    }

    public override Task OnErrorAsync(InterfaceContext context)
    {
        return base.OnErrorAsync(context);  
    }
}



果糖网