The talk was done against the beta 6 version of the runtime, so release-wise, it was quite a way back.
To celebrate today’s release of ASP.NET Core RC2, I have updated the code samples from the talk to that RC2 version. Hopefully folks would still find it useful.
Getting started 🔗
You can get started with ASP.NET Core RC2 by following this official link.
You will need to uninstall all old releases and install either the command line tooling or the entire VS-preview tooling (all the instructions are provided at the .NET Core site above).
Sample code 🔗
The updated code sample that accompanied the talk is available at Github.
While it is by no means a full, large scale API, the idea is, as mentioned in the talk, to show how various components and configuration details, familiar form the ASP.NET Web API map to the new world. In that sense, the demo code tries to touch a bunch of different features.
Some of the things highlighted in this demo code are:
- Web API style content negotiation
- exception handling matching the ASP.NET Web API approach to exception handling
- using HttpResponseMessage in ASP.NET Core
- building custom formatters
- building middleware to port message handlers
- porting filters and DI into filters
- using query-string to force response media type with FormatFilter
and a few more things.
Hopefully this will still be useful to you as you try to port your Web API applications.
Interestingly, upgrading this from ASP.NET 5 beta6 to ASP.NET Core RC2 was surprisingly easy, took me maybe 1 hour at most, and mainly revolved around changes to package names and namespaces. There were a few behavioural changes (for example the introduction of a new abstraction, IUrlHelperFactory) and so on, but they were fairly easy to address.
Once again, you can grab the source from Github.