Validation Application Block – Unit Test Validation Logic

The Enterprise Library Validation Application Block (VAB) is a great library for putting your validation in your business layer where it belongs rather than in the UI. It allows us to apply attributes to the properties of our business objects like this: public class Person { [StringLengthValidator(1, 20, MessageTemplate="First Name must be between 1-20 characters.")] public string FirstName { get; set; }   [StringLengthValidator(1, 20, MessageTemplate="Last Name must be between 1-2...


Use Lambda expression to create a generic KeyedCollection

The .NET framework ships with an abstract KeyedCollection<TKey, TItem> class [http://msdn.microsoft.com/en-us/library/ms132438.aspx].  Basically, all you have to do is implement the GetKeyForItem() method you can could look up any item either by ordinal or a customized key. For example, suppose you had a Person class like this: public class Person { public Guid ID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } And suppose you wanted to...


C# 4.0 Named Parameters for better code quality

Sometimes new features are added to a language which fundamentally change how we do things (e.g., when generics was added to .NET 2.0). However, there are other times when features are added to the language that are "syntax sugar" or "nice to have's". My outlook on those items has always been that "syntax sugar" is typically a good thing – if there is some feature that allows the code to be more expressive/readable then that is a great thing. Sure, the IL might not be any different behind the sc...


Visual Studio Magazine Article on ASP.NET MVC

I just had an article published in the Visual Studio Magazine January 2009 Issue [http://visualstudiomagazine.com/issue/archive/issue.aspx?issue=418] on the ASP.NET MVC framework. The direct link to the article is here: http://visualstudiomagazine.com/features/article.aspx?editorialsid=2611 One correction is that the "About the Author" section at the bottom of the article is out of date since I am no longer employed at e.magination. I am now with Applied Information Sciences (AIS) [http://...


ARCast.TV Interview on Channel9 - 64-bit Computing Technology for Highly Scalable Applications

In the past couple of years, I had the unique opportunity to lead of team of developers building one of the highest (if not THE highest) volume .NET application in the world.  With more than 3 billion requests per day and an SLA of 99.99% of requests under 250ms, we had some exciting challenges. Because the application was so performance intensive, we heavily utilized a huge in-memory cache.  Because of the size of our cache, we had some interesting challenges to overcome with .NET garbage colle...