MVC - Where To Put Business Logic?

I just had an email from a friend asking where business logic should go when using MVC - the controller or the model. I thought I'd share my reply: I think asking whether the business logic should go in the

Testing IoC Registrations

When I first started writing automated unit tests for my code, I remember getting carried away writing lots of tiny little tests, each with a single Assert. It felt good initially to see all those green ticks, but rapidly became

WCF - Logging Before and After Operation Invocation

Here’s another custom WCF EndpointBehavior I found useful recently. Not content with logging all unhandled errors, I wanted to output a DEBUG level log message before and after every operation invocation. As before, I’m using the Castle Windsor

WCF - Global Exception Handling

I’ve done a fair bit of WCF development recently (and amazingly I came out of it relatively unscathed, both psychologically and emotionally). Using Castle Windsor’s WCF Facility helped a great deal, but I still found myself writing a

Testing LINQ Queries

I’ve been asked “How do you test LINQ queries?” a couple of times in the past few months, so I thought I’d blog my answer for the benefit of all you lovely people. Firstly I should explain how

An MVC Gotcha and the PRG Pattern

If you’ve recently moved across to ASP.NET MVC development following years of wrangling with the leaky abstraction that was WebForms, you may have encountered some seemingly curious behaviour when posting back to the same URL. Suppose we have

MoreLINQ - IEnumerable Extension From Jon Skeet

I’ve just become aware of this MoreLINQ project containing some neat IEnumerable extensions authored by the inimitable Jon Skeet. I particularly like the look of DistinctBy – that’s gotta be a lot easier than passing custom instances of IEqualityComparer