Example #1
0
 public static ApiExceptionHandler GetInstance()
 {
     if (_instance == null)
     {
         _instance = new ApiExceptionHandler();
     }
     return(_instance);
 }
        private void FillExceptions()
        {
            Handlers = new List <BaseExceptionErrorHandler>();
            Handlers.Add(ApiBusinessExceptionHandler.GetInstance());
            Handlers.Add(ApiDataExceptionHandler.GetInstance());
            Handlers.Add(ApiExceptionHandler.GetInstance());
            Handlers.Add(DbEntityValidationExceptionHandler.GetInstance());
            Handlers.Add(GenericExceptionHandler.GetInstance());
            BaseExceptionErrorHandler _handler;

            for (int i = 0; i <= Handlers.Count(); i++)
            {
                _handler = Handlers.ElementAt(i);
                if (i + 1 == Handlers.Count())
                {
                    break;
                }
                _handler.Mychainhandler = Handlers.ElementAt(i + 1);
            }
        }