WebAPI, PascalCase and camelCase

In the RAW stack the ASP.NET WebAPI plays a big part in exposing data to the client and accepting data back in. This does mean that it is also the boundary of the AngularJS, or JavaScript, and C# world. And both of these worlds have their own, not always compatible standards. In this case I am referring to the normal way of naming properties on objects. In C# this is normally done using PascalCase and in JavaScript this is normally done using camelCase.   Bridging the gap It turns out that being able to use the normal conventions on each … Continue reading WebAPI, PascalCase and camelCase

Paging data using AngularJS and RavenDB in the RAW Stack

So far loading and displaying some movies data has been pretty simple and straightforward. However something that was not immediately apparent was that not all movies in the database where shown. When opening the movies list there where just 128 movies visible and that was not all there was to show. In fact I have used the Rotten Tomatoes API to preload the database with more than 1000 movies and even though I never added a filter anywhere most of these didn’t show up. So what is going on?   RavenDB = Safe by default RavenDB really is an awesome … Continue reading Paging data using AngularJS and RavenDB in the RAW Stack

Using dependency injection with WebAPI in the RAW stack

In the previous blog post we added some unit tests that tested the WebAPI and also included the RavenDB storage behind it. As I explained the recommendation is not to use fakes or mocks but just to use the in memory variant of RavenDB during testing. However the WebAPI controller used a static RavenConfig.Store property to get to the RavenDB database. And that is the kind of hard coupling we would prefer not to have even if we don’t need to create a fake for our tests.   Adding Ninject to do our server side dependency injections There are many … Continue reading Using dependency injection with WebAPI in the RAW stack

Unit testing the WebAPI controller and RavenDB database in the RAW stack

In the previous post we added unit tests for the AngularJS code running on the client. And while these tests are important there is more to test. After all the client side code depends on a server side WebAPI controller and a RavenDB database. In this post we are going to add unit tests for those two.   To inject or not to inject dependencies Normally when one class depends on another it is best to use dependency injection to get one to use another. And the dependency is then based around interfaces so a dependency can be faked during … Continue reading Unit testing the WebAPI controller and RavenDB database in the RAW stack

Creating a basic skeleton with the RAW stack

When I start with a new stack one of the first things I always do is create a really simple app to do something sort of meaningful. So lets do that with the RAW stack.   Just as a reminder the RAW stack is a combination of RavenDB, AngularJS and WebAPI. These three technologies combined make a pretty awesome combination for a developer wanting to make smart client side web applications and is using .NET on the server.   As the demo application I will be building is all about movie reviews and rentals lets start my a very minimalistic, … Continue reading Creating a basic skeleton with the RAW stack

Introducing the RAW stack

With this post I am introducing the RAW stack. Why the RAW stack? Well it is kind of the equivalent of the MEAN stack. Not that there is anything wrong with the MEAN stack, quite the opposite, but being a .NET developer I really like to keep using .NET where it’s strengths lie and where it is suitable. Now there are plenty of places where it isn’t but C# on the server is still quite awesome.   So what is the RAW stack? Basically the RAW stack consists of three parts. RavenDB AngularJS WebAPI   Why these three? RavenDB Well … Continue reading Introducing the RAW stack

Unit testing a ASP.NET WebAPI 2 controller

Earlier this year I wrote a blog post about how to unit test ASP.NET WebAPI controllers. It turned out that in order to do a good job of testing the public ApiController methods you would need to quite a bit of setup. Most of the time this was just about providing a HttpConfiguration object but sometimes, like in the case of responding to a post request, quite a bit more would be required. One of the goals of the ASP.NET WebAPI 2 was to make testing of controllers easier. This has been achieved by adding a new response interface named … Continue reading Unit testing a ASP.NET WebAPI 2 controller

On versioning WebAPI REST services

When you develop REST services you are going to run into the little matter of versioning, there is just no way to avoid it if you want to make any change to your REST service. Now there are lots of different ways to go about this and these different ways have their pro’s and con’s. What your version strategy is also depends on if your REST services are read-only or read-write with read-only services being somewhat simpler due to their smaller API surface. In these examples I am using the ASP.NET WebAPI but these same principles apply to REST services … Continue reading On versioning WebAPI REST services