Creating a KnockoutJS model from an ASP.NET MVC model

This article will demonstrate how to dynamically create a KnockoutJS view model from a C# model in an ASP.NET MVC project and will build on the code from the previous article Getting Started With ASP.NET MVC and KnockoutJS.

Getting started with ASP.NET MVC and KnockoutJS

This is the first article in what will hopefully be a series on using KnockoutJS with ASP.NET MVC and is intended to demonstrate techniques for combining the two technologies in your work.

(Don't) Static All The Things!

Sometimes when you first start working on an existing project you come across some code that’s a bit quirky or weird. This is normally due to personal preferences or misunderstandings but whatever the reason, you can live with it - it’s not that bad. Other times you just come across code that makes you quietly weep as you resign yourself to spending the next few months in this hell; a .NET project which uses the “Static Everything” (anti-) pattern is one of those times (is this actually a pattern? I don’t know but I’ll be calling it a pattern throughout this post).  The Static Everything pattern is when core operations and business logic in a code base is mostly made up of static classes with static utility methods scattered everywhere; some of which may even have static “state” (!!).  This is typically accompanied by simple domain/model classes that simply define properties for an entity.

Visual Studio Regions Make Me Cringe

The topic of Visual Studio regions feature is one that seems to create divided opinions from developers who work with the IDE on a regular basis.  If you can’t guess my opinion from the title of this article, I personally totally and utterly hate seeing regions in code.

Stringly - Dynamic Query Building Library

Stringly is a dynamic query building library written in C#.  It provides an interface for dynamically creating queries from string based inputs which is useful for scenarios where the structure of queries is determined at run time based on an external input.  Stringly works by building a collection of metadata which it can then use to build a query.

Supernova Particle System for MonoGame

Version 1.0 of Supernova Particle System for MonoGame now available!  Supernova makes it easy to setup particle effects in your games developed using MonoGame.  It was ported to run on MonoGame from my original XNA particle system on CodePlex.

Use of SPContext.Current in SharePoint Code

First off, there’s nothing wrong with using SPContext.Current; this article is about using it correctly and structuring your code to work with it in a flexible way.

In-Memory Database Using Fluent NHibernate

When writing unit tests dealing with code that communicates with the database can be a pain.  All the information on Test Driven Development on the internet and in books always recommends that you avoid hitting the database.  Avoiding interacting with the database naturally has positive performance implications and has the additional advantage of not cluttering up a test database with a bunch of data created in our unit tests.  I’ve found that this lets me simplify my unit tests because I can make certain assumptions about the state of my data. There are different ways of avoiding interacting with a database but the two ways I have used are:

Using T4 Templates to Remove String References to ASP.NET MVC Actions

Ever since I started working with ASP.NET MVC there has been one thing that has bugged me a little bit; needing to reference my strongly-typed Controllers and Action methods by their string names.  It’s not a major problem for me but last night I decided to have a go at solving the problem for a project I’m currently working on.  There are the obvious simple solutions such as manually creating string constants or HtmlHelper and UrlHelper extension methods.  In the past I have used the extension method approach but frankly it’s a real pain to maintain going forward with updating names, removing methods, adding new methods etc.  In my opinion developers shouldn’t have to worry themselves with this kind of work when we can leave it up to the IDE (Visual Studio 2012 in this case) to do this monotonous work for us.