Return types, action parameters and data annotations now available in Web API 2.1 Help Page

On Friday Microsoft released a 2.1 version of Web API (along with MVC 5.1 and Web Pages 3.1). The release announcement was made yesterday and can be read here - but pretty much all of the new features have already been discussed on this blog, when we dissected the 2.1 RC released last month.

One thing I wanted to highlight today though, are the changes to the Help Page, and its new capabilities to document return types, action parameters and data annotations on your models/DTOs.

OWIN/Katana in-memory integration testing

A while ago we looked at testing the ASP.NET Web API pipeline using its in-memory hosting capabilities.

The advantages of such approach to end-to-end testing are unquestionable.

Now, with the emergence of OWIN as the primary hosting option for a wide array of web frameworks, it makes sense to explore how you could to the same, except in the OWIN (or rather Katana, since all the things shown here are Katana specific) context - so not just against Web API, but against any framework of your choice (running on top of OWIN & Katana).

ASP.NET Web API 2.1 RC is out – what’s new?

It seems that only yesterday we were blogging about new features in Web API 2 and discussing what’s coming up next for Web API at the MVP Summit.

Meanwhile, the ASP.NET team kept it’s frantic work pace and already before Christmas dropped on Nuget a 2.1 RC of Web API (as well as new MVC and Web Pages).

While in the open source mode of operation (public commits, nightly builds) this is that big of a news, it is still a very nice piece of news. Let’s look at what’s new.

Easier Redis development with scriptcs and ServiceStack.Redis powered C# REPL

In my current project I am working a lot with Redis on the back end. What I have found extremely useful is the ability to work with Redis directly from its REPL (redis-cli), to instantly check or reset the objects stored there.

However, working in the C# environment, the basic redis-cli is definitely not enough to facilitate productive development.

Enter scriptcs.

Asynchronous action filters in ASP.NET Web API

It is rather to common to use filters in Web API to perform common tasks around your actions in an AOP (aspect oriented programming) way.

To create a filter you simply inherit from an abstract ActionFilterAttribute class and override the relevant method:

public abstract class ActionFilterAttribute : FilterAttribute, IActionFilter  
{  
public virtual void OnActionExecuting(HttpActionContext actionContext)  
{}

public virtual void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)  
{}  
}  

This is all nice and simple, but what if the operation you need to perform, should by asynchronous? Surely async void is a terrible idea.

Output Caching in ASP.NET Web API 2

A while ago I released a little library for Web API caching - called CacheOutput.

With the release of Web API 2, some things change (obviously the Web API core gets a bump to 5.0) so the library required a new release. I have decided to take a page out of the book of my friends over at Autofac, and do not release over the old Nuget package, but instead release a new one specifically for Web API 2.

If you are in need of caching for Web API 2, you should use the package called Strathweb.CacheOutput.WebApi2

ASP.NET Web API 2 is out! Overview of features

Today the ASP.NET team released ASP.NET Web API 2 (and, for that matter, MVC 5 too)! The announcement, just as like year, followed many other big Microsoft releases (Windows 8.1, Visual Studio 2013 etc) in a synchronized product shipping event.

New Web API is now available on Nuget - where it directly replaces the old version of Web API. Let’s look at the major features of ASP.NET Web API 2.

Extend Glimpse on the fly – scriptcs code execution tab in Glimpse

In scriptcs, one of the things we have been paying lots of attention to recently, is the hosting story. Scriptcs CLI is simply just one of the clients using the core scriptcs libraries - which can be used to embed the rich scriptcs code parsing and execution capabilities in any app.

This weekend I put together a small Glimpse plugin which uses scriptcs hosting, and can be used for executing arbitrary code against the context of your ASP.NET application.

More after the jump.

Dynamic per-controller HttpConfiguration in ASP.NET Web API

Recently I faced an interesting problem, where we needed to provide controllers with controller-specific configuration - but based on settings only known at runtime.

In Web API, per-controller configuration is a very useful, yet little known feature (aside from a great blog post by Mike Stall), as it allows you to create configuration profiles and assign them to specific controllers.

However it is only supported statically - through attributes, so it cannot be altered at runtime. Let’s have a look at how you might be able to hack away at it.

Adding high performance Windows Azure Cache Service to your ASP.NET Web API

Microsoft has recently announced the preview release of Windows Azure Cache Service - intended to allow you to easily deploy high performance, dedicated, distributed cache for your applications.

You can read more about the feature (and it does seem really awesome at first glance), in the thorough announcement post by Scott Guthrie.

Let’s look at how you can leverage this powerful service from ASP.NET Web API.

About


Hi! I'm Filip W., a cloud architect from Zürich 🇨🇭. I like Toronto Maple Leafs 🇨🇦, Rancid and quantum computing. Oh, and I love the Lowlands 🏴󠁧󠁢󠁳󠁣󠁴󠁿.

You can find me on Github and on Mastodon.

My Introduction to Quantum Computing with Q# and QDK book
Microsoft MVP