try-catch-FAIL

Failure is inevitable

NAVIGATION - SEARCH

Globally handling status messages in ASP.NET MVC

I’m a big fan of pushing common concerns down into the infrastructure and framework of an application so that developers can easily leverage them.  One such concern that may come in a web application is displaying status messages, such as “Record Saved” or “There was a problem communicating with the database”.  My initial attempt at adding such functionality to RageFeed failed to encapsulate the concept of a status message, but after rethinking it and actually modeling it as an explicit action, I came up with an approach that I really like. The Problem It’s been a while since I’ve ... [More]

A More Fluent API For AutoMapper

I love AutoMapper.  I’ve used it in virtually every ASP.NET MVC application I’ve ever worked on.  It has saved me countless lines of tedious code, and it’s quite smart at inferring the correct mappings.  However, my one complaint is that the API for specifying the more complicated mappings is, in a word, ugly.  It’s flexible, sure, but ugly.  In this post, I’ll show you how a few simple extension methods that can make things much prettier. First, let’s consider a very trivial (fictional) domain model and corresponding view model: public class Widget { public s... [More]