NuGet: Solita.Episerver.WebApi - WebApi toolkit for Episerver

We, Solita, wish to share our WebApi productivity improvements as a NuGet package, and of course in open source. The source code was released for public in February, but we have used the most of it in production for over a year* with great results. Feel free to implement, contribute and fork :)

1. WebApi error loggingBy default, Episerver does not log exceptions that happen during WebApi requests. This ExceptionHandler will log the exact URL and the stacktrace. And if you are on the localhost, or an Admin, WebAdmin or WebEditor user, you also get the stacktrace as a result when executing the request to ease debugging, otherwise a plain "An error has occurred" is returned to the caller for security reasons. Here is a log example.

2. WebApi output cachingAttribute that caches the result for a requested WebApi method. The cache is invalidated when Episerver content changes, so no need to worry about it getting stale. This helps a lot on pages that execute the same XHR request on every load.

3. WebApi language contextAttribute that automatically sets the correct language context when the WebApi method is called with a language parameter. After that, you can access the Episerver APIs without explicitly defining the language, just like with PageControllers.

4. WebApi automatic model validationAttribute that automatically returns HTTP Bad Request (400) with error details if the model validations fail. No need to do the checks manually in the controller.