A Quick and Dirty Cache

Brownfield development on a tight deadline is never fun, it’s never elegant and it’s certainly not satisfying. One problem I keep finding is code that repeatedly calls the backing stores with the same query. If I don’t have the time to refactor the code to work properly I sometimes cheat and use a cache that’s

Continue reading »

Forcing Culture Settings in WCF

I had the need to force the thread culture on a WCF service recently. The culture kept dropping back to en-US, but I needed it to run in en-GB as the client was sending me files with UK dates in them. After banging my head against every setting I could find I gave up and

Continue reading »

Timestamp Your Assembly Version

Recently Jimmy Bogard (@bogardj) blogged about a simple, but very effective versioning strategy for .Net assemblies. I thought I’d show you how I implemented that for a project I’m working on. I opted to use MSBuild Community Tasks, which can be downloaded from here. To get started, crack open your .csproj file and find the

Continue reading »

Getting Started with Rails

I started in BASIC, moved to Java, then to .Net. After working in .Net for about 6.5 years it’s time to properly learn something new. I’ve had my eye on learning Ruby on Rails for a while, but haven’t ever really had a reason. I still don’t have a compelling reason, but I’m going to

Continue reading »

A Gotcha when Comparing ImageFormat in .Net without TDD

I’m not there yet, but I’m working towards doing TDD / BDD for nearly all of my code. Even though I’m doing a lot of Web Forms development at the moment I’m discovering that it is still possible to drive a very large portion of my development through testing. Occasionally when I’m in a rush

Continue reading »

Unit Testing in 1995, Hello ASP .Net Membership Providers

Among the many wonders that is .Net we have the task parallel library, linq, a first class garbage collector and the legend that is Jon Skeet. If, however, you have the crazy desire to unit test code that relies on System.Web.Security.Membership you’re in for a world of pain. To ease that pain slightly I’ve created

Continue reading »

Enable SSL in web.config for SmtpClient

If you want to use SSL when connecting to your email server and are using the SmtpClient from .Net 4.0 you can now set EnableSSL via the web.config file, which you couldn’t do before. I’m only posting this because the docs (http://msdn.microsoft.com/en-us/library/w355a94k.aspx) for .net 4 don’t seem to bother mentioning it, which is a bit

Continue reading »

An imperfect Hack to Keep App_Offline Showing When You Delete Your Web App

In a simple world, a good solution for deploying web apps looks a bit like this: Remove server from load balancer Remove old site Install new site Verify installation locally Add server back into the load balancer Nice and simple, now you just move onto the next server and repeat the process. The problem I

Continue reading »

So you’d Like Implicit Casting in Moq?

I love using Moq, it’s great and it saves me a huge amount of time and effort when I’m writing unit tests. There’s only thing that bothers me about it. The Object property on a mock, why is this even needed? Surely the judicious use of the implicit keyword and you could have a cleaner

Continue reading »

FindParent Extension Method for Web Controls

This is another one of those tiny bits of code that I’ve written too many times and I don’t want to waste my time thinking about again. It’s simple, but I’m bored of writing it. I’ve also posted it to http://www.extensionmethod.net (http://www.extensionmethod.net/Details.aspx?ID=415) Anyway it all its limited glory; public static T FindParent(this Control target) where

Continue reading »