June, 2014

21st

2 comments
  • mac
  • osx
  • swift

Using Swift REPL from Sublime Text

Sublime Text is by far my favorite text editor. In its rich ecosystem of plugins you can find some absolute gems, and one of those is SublimeREPL which adds support for REPLs of various programming languages directly into your Sublime Text.

Swift is missing from there – but let’s add support for it!

Continue reading

17th

9 comments
  • mac
  • osx
  • swift

Using Swift As General Purpose Scripting Language

One of the big advantages of Swift is that it gives you access to all Cocoa APIs and lets you use them in some very flexible ways.

One of those is the possibility to use Swift as a general OS “scripting” language – instead of bash, PyObjC or C or any other option that you might have opted for in the past. Moreover, you can do that entirely from outside of XCode – so write your Swift program in any editor and then simply use Terminal to execute it, as if it was pure script.

The obvious advantage of such approach is that you now have the same single language to handle iOS programming, OS X app programming and generic system/automation tasks that you might want to perform from the command line.

Let’s have a look.

Continue reading

11th

11 comments
  • .net
  • asp.net mvc
  • asp.net vnext
  • c#

POCO controllers in ASP.NET vNext

Because lightweight is better!

One of the very cool features of the vNext of ASP.NET MVC (a unified framework set to succeed MVC, Web API and Web Pages) is the ability use POCO classes as controllers. No base class, no interface to implement, 100% convention.

Let’s look a little bit into that.

Continue reading

May, 2014

21st

15 comments
  • .net
  • asp.net web api
  • c#

Announcing ASP.NET Web API Recipes

spacer It is my pleasure to announce that this summer my ASP.NET Web API book will be released. It’s entitled "ASP.NET Web API Recipes", and will be published by Apress.

While the publication date is not set in stone yet (probably early August), you can already pre-order at:
– Apress
– Amazon

The idea behind the book is quite simple – to discuss and dissect some of the most common problems and issues you might encounter in your work with Web API solutions.

There is going to be a total of 12 chapters with about 10 recipes per chapter (the number varies obviously). You will also get a full VS project with source code per each recipe.

Continue reading

April, 2014

23rd

1 comment
  • .net
  • asp.net web api
  • c#
  • owin

Ignoring routes in ASP.NET Web API

If you use centralized routing, it is occasionally needed to ignore a greedy Web API route so that the request can be processed by some other component or handler.

One of the tiny overlooked features of Web API 2.1 was that it finally shipped with a cross-host way to ignore routes. It’s not too exciting, as it’s something that’s been in MVC for ages, but it’s nice to finally have an easy way to do it in Web API.

Continue reading

9th

1 comment
  • .net
  • asp.net web api
  • c#

Opt in and opt out from ASP.NET Web API Help Page

The autogenerated ASP.NET Web API help page is an extremely useful tool for documenting your Web API. It can not only present information about the routes, but also show sample requests and responses in all of supported media type formats, and even display information for DataAnnotations.

However, more often than not, you don’t want all endpoints to be visible in the help page. Let’s have a look at how you can opt in and opt out from the ASP.NET Web API Help Page with your resources.

Continue reading

March, 2014

20th

2 comments
  • .net
  • asp.net web api
  • c#

ASP.NET Web API exception logging with Raygun.io

Jon Galloway recently wrote a monster 4-part series covering the new features of MVC 5.1 and Web API 2.1 releases. One thing he mentioned was the new IExceptionLogger for Web API, and he called out the community to provide some example implementations of it.

Therefore, let’s have a look at how you’d approach that – with a sample of logging Exceptions to the excellent Raygun service from Mindscape.

Continue reading

8th

5 comments
  • .net
  • asp.net web api
  • c#

Per request tracing in ASP.NET Web API

Web API allows you to plug in extensive logging mechanism through the ITraceWriter service. This will log all important events in the pipeline – such as selection of the controller, action, parameter binding and so on – all of which are extremely important in debugging all kinds of issues.

However, any existing instance of an ITraceWriter would log all of the information aside – into a log file, trace, database. But what if you wanted all the trace information produced while the given request was being processed, to be returned together with the server response?

Let’s have a look.

Continue reading

February, 2014

21st

6 comments
  • .net
  • asp.net web api
  • azure
  • c#
  • nancy

Running the OWIN pipeline in the new .NET Azure Mobile Services

OWIN in ZUMO!

Yesterday, a preview of the .NET Azure Mobile Services has been released. Despite the fact that I’d rather see a scripted C# support spacer – I am still very excited about this new .NET support, as ZUMO is one of my favorite Azure offerings.

The whole thing is in preview right now and runs on Web API (version 5.1 at the moment, so not the latest) but the team has made several very smart decisions, which I am sure the community will welcome with open arms. One of them is the ability to plug in your OWIN pipeline!

Continue reading

18th

8 comments
  • .net
  • asp.net web api
  • c#
  • odata

Getting started with OData v4 in ASP.NET Web API

Because v4 is almost here!

Since yesterday, the ASP.NET Web stack nightly feed contains the packages supporting OData v4. The package is called Microsoft.AspNet.OData and has a working version 5.2.0 – so I’m guessing this is intended to ship with Web API 2.

It relies on the latest beta of Microsoft.OData.Core. OData v4 is a massive changed compared to v3 – you can read about all of them here.

Continue reading