通过AOP实现现日志
//注册ReZero.Api
builder.Services.AddReZeroServices(api =>
{
var apiObj = new SuperAPIOptions();
....省略....
//只看这3行行
if(apiObj.InterfaceOptions==null)
apiObj.InterfaceOptions = new InterfaceOptions();
apiObj.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);
}
}2016 © donet5.comApache Licence 2.0