Explicit Route Construction in MVC

Instead of using the standard MVC routing approach, I needed full control over route construction. In particular, I need to be able to supply routing names for a group of related scenarios. Gets replaced with: Later, I can modify this example to supply the default BusinessArea value.

Ninject Session Scope

Here’s an implementation of InSessionScope(). I fall back to Singleton scoping when session isn’t available (mainly to make testing easier): If we need to synchronize session between MVC and Web API, we need to add the following to the Global.asax:

NinjectControllerActivator for Injection in ASP Web API

We need to replace Web Api’s default controller activator with a custom implementation that uses the Ninject kernel. This happens in the Ninject bootstrapper code: The custom controller activator:

SQLBITS XI, Nottingham

Second day here, and it’s going well (despite having a cold). Highlights were yesterday’s training on SSDT, courtesy of Jamie Thomson and an interesting session today on Hadoop and Microsoft’s HDInsight offering.

Ranking Functions in Linq

My starting point for this exercise was to apply a simple racing-rank to a list of integer values. Here’s my list… 8, 4, 5, 6, 6, 3, 5, 9, 10, 1, 0, 6. And this is my expectation… 0 = 1st 1 = 2nd 3 = 3rd 4 = 4th 5 = 5th (there are two items in 5th place) 6 = 7th (there are three items in 7th [...]

Deleting problem folder

Annoyingly, Microsoft updates dumped the the software pack files for one of its updates on my removeable drive recently. Subsequently, I was having all sorts of issues trying to delete (take ownership) of the file. Command-line did the trick… takeown /f <foldername> /r /d y icacls <foldername> [...]

Unravelling TargetInvocationException

I use Moq for testing. This framework (along with others) uses Castle.Core to create it’s proxy instances. A problem you run into is trying to assert for specific exceptions thrown from the proxy’s constructor, as Castle likes to wrap these in a Reflection.TargetInvocationException. In order to get [...]

Mapping Dictionary Values to Class Properties

Here is some code that I wrote to map values Dictionary to properties on a class. I have since realised that the JavaScriptSerializer provides a ConvertToType<T> method that achieves the same thing. As I was already working with Json serialization making the change was trivial.

Keeping it simple with Trello

I’ve adopted Trello at work as a general purpose organisational tool for our team, and we’ve been using it for a little over 1 week now. It’s a beautifully simple execution of the ‘list’, and has all the features you’d want from a basic online organisational [...]

Friends don’t let friends … Use IE6

I loved this official Microsoft site when it appeared earlier this year. I am still being regularly asked to build web applications that are backwards compatible with IE6… please… for the love of all you hold sacred… stop using IE6!
Go to Top