示例#1
0
        public static void Register(HttpConfiguration config)
        {
            config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            object loggerObject = config.DependencyResolver.GetServices(typeof(IExceptionFileLogger)).FirstOrDefault();

            IExceptionFileLogger logger = loggerObject as IExceptionFileLogger;

            config.Filters.Add(new ExceptionLoggerFilter(logger));
        }
示例#2
0
 public ExceptionLoggerFilter(IExceptionFileLogger exceptionFileLogger) : base()
 {
     ExceptionType        = typeof(BaseCustomException);
     _exceptionFileLogger = exceptionFileLogger;
 }