在.NET Core项目中,我有一个像这样定义的Filter类:
[AttributeUsage(AttributeTargets.Class)]
public sealed class GlobalExceptionFilterAttribute : ExceptionFilterAttribute
{
... }
}
我可以参考
public class WebApiApplication : HttpApplication
{
protected void Application_Start()
{
GlobalConfiguration.Configuration.Filters.Add(new GlobalExceptionFilterAttribute());
}
}
}
如何在类库或控制台应用程序中实现过滤,它与Application_Start相同?谢谢