Today, Glenn is announcing at the BUILD conference that Web API preview 5 is available both on CodePlex and Nuget. If you’ve been following the project for while, you’ll note that we went through a dry spell there for a while regarding updates. This was due primarily to the level of manual effort involved in updating our bits. Fortunately, we recently automated away all of that manual effort and are excited to get you new bits (and excited about getting bits to you much more frequently going forward). Here is a high level list of what you can expect to see in preview 5 as well as some notable changes.
- OData Formatter
- Dependency refactoring from host common code
- Support for Batch with mime/mixed content where every part has a full Http request
- Web API code-based configuration (simplifications)
- Web-based test client for WCF Web API
- Http File upload
- Refactored formatters
- Better IoC support
- Additional samples for specific features such as file upload
- Content negotiation now supports qualifiers
- ActionOfStreamContent – Enables accessing the raw content stream
- New HttpMemoryBinding to enable in-memory hosting and invoking of Web APIs
New Prototype Features (on WebAPI-Prototype branch)
- WebApiConfiguration includes conventions for WebGet/WebInvoke
- WebApiRoute provides better side by side integration with MVC routes
- MapServiceRoute extension method simplified registration and usage of WebApiConfiguration
- SetDefaultHttpConfiguration / GetDefaultHttpConfiguration extension methods enable the getting and setting of a global configuration object that will be used by default by MapServiceRoute unless a specific one is provided
- MediaTypeFormatterCollectionExtensions.AddRange enables a more compact way to add formatters
- Task<T> for Web API operations and sample
- DelegatingChannel renamed to DelegatingHandler
- HttpChannel renamed to HttpMessageHandler
- FormUrlEncodingMediaTypeFormatter and JsonValueMediaTypeFormatter were moved from the default branch to the WebAPI-Prototype branch as they are not currently part of the core product source
- DelegatingHandler no longer require passing in a channel in the constructor making it more friendly to inversion of control (IoC) containers
- New constructor overload on HttpMessageHandlerFactory overload which accepts a Func<IEnumerable<DelegatingHandler>> to allow user code or IoC containers to construct handlers.
- IQueryable previously supported case-insensitive matches on operators. In the current drop we only will match on lowercase operators i.e. “$top” but not “$Top”. According to the spec this is correct behavior however we could relax it in the future.
Like I mentioned above, preview 5 is also being released on Nuget today. Here’s the breakdown of the Nuget packages that will be available:
- HttpClient– like it sounds, this gives you the HttpClient object model, which can be used by both the server and the client for a symmetric Http programming experience.
- JsonValue– Contains JsonValue api for typeless / dynamic access to Json.
- WebApi– The server-side object model for Web API
- WebApi.All– preserved for backwards compatibility; basically just pulls in everything.
- WebApi.Core– preserved for backwards compatibility; pulls in WebApi.0.5.0
- WebApi.Enhancements– gives you the Web API core product code plus the enhancements library (from the prototype branch)
- WebApi.OData – enables returning OData from a Web API.
In addition to the core Nuget packages, we’re also pushing up a set of symbol packages so that you can more easily debug through Web API source code.
In addition to updating the source code and binaries, we’ve pushed up a more current set of getting started material, including both information on getting started with the core product bits and information on getting started using the Http enhancements library on the prototype branch. There’s even this video on how to take advantage of our built-in test client.
Navigating Our CodePlex Repository – the WebAPI-Prototype branch
One thing that we wanted to improve with this push was a more clear view of what was product code and what was prototype or proof-of-concept code. Therefore, we created a ‘WebAPI-Prototype’ branch and pulled all non-product code (which translates into all code that is not checked into our internal source control) out of the default branch and into the prototype branch.
This structure provides 2 main benefits:
- As mentioned above, better transparency between supported product bits and proof-of-concept bits
- By having the default branch be a reflection of our internal repository, we can update it much more frequently because we won’t have to account for any changes that would have happened outside of our internal repo.One thing to note about the introduction of this branch is that samples currently live in the prototype branch – so if you want to use the samples as a way to get started building with Web API, you’ll want to update to the prototype branch. That said, there are samples that exist in the ‘Tests/*/Scenarios’ folders. For example, the Mime multipart sample can be found at ‘Test\Microsoft.Net.Http.Formatting\Scenarios\MimeMultipart’.
As you can see, we’ve added a lot of new goodness with preview 5 and are excited to have you test-drive the bits and let us know what you think. And again, now that we’ve automated the process of getting our code pushed to CodePlex, expect to see updates coming regularly.