0

In a .NET Core project I have a Filter class defined like this:

[AttributeUsage(AttributeTargets.Class)]
    public sealed class GlobalExceptionFilterAttribute : ExceptionFilterAttribute
    {
        ...    }
        }

which I can reference from

public class WebApiApplication : HttpApplication
    {
        protected void Application_Start()
        {
            GlobalConfiguration.Configuration.Filters.Add(new GlobalExceptionFilterAttribute());
        }
    }
}

How can filtering be implemented also in a class library or in a console app, what it is the equivalent of Application_Start there? Thank you

Sami
  • 393
  • 8
  • 22
  • Possible duplicate of [Is there an equivalent of Application\_Start for a class library in c#](https://stackoverflow.com/questions/7655222/is-there-an-equivalent-of-application-start-for-a-class-library-in-c-sharp) – Rohit416 Jun 30 '17 at 05:21
  • These filters are specific to web applications and their request processing pipeline. I think you are looking for a global exception handler for a console application. This question and it's answers should help: https://stackoverflow.com/q/3133199/642579 – Markus Jun 30 '17 at 06:20

0 Answers0