Aop日志

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);  
    }
}


配置日志

https://www.donet5.com/Doc/32/2638


果糖网