Advertisement
Guest User

TypeFilter idea

a guest
Sep 4th, 2015
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. namespace mylibrary
  2. {
  3.     public class MyFilterAttribute : TypeFilterAttribute
  4.     {
  5.         public MyFilterAttribute() : base(typeof(MyFilterImpl)) { }
  6.     }
  7.  
  8.     internal class MyFilterImpl: ExceptionFilterAttribute
  9.     {
  10.         private MyClass _dependency;
  11.  
  12.         public MyFilterImpl(MyClass  dependency)
  13.         {
  14.             _dependency = dependency;
  15.         }
  16.  
  17.         public override async Task OnExceptionAsync(ExceptionContext context)
  18.         {
  19.             // do your stuff
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement