Using and Disposing of WCF Clients

Designing an interface always requires careful considerations of how it will be used. Scott Meyers elegantly catches the entire problem in one sentence in his book Effective C++: Make interfaces easy to use correctly and hard to use incorrectly. The people at Microsoft who were in charge for the WCF client code generation either hadn’t read… Continue reading Using and Disposing of WCF Clients

Traversing Expression Trees

The Expression<T> data type which was introduced together with LINQ is interesting. When a Func<TResult> is wrapped in an Expression<T> the code is no longer completely compiled, instead it is preserved as an expression tree that can be traversed during runtime. This is what the method ExpressionHelper.GetExpressionText() that I used in my last post Type Safe SelectList… Continue reading Traversing Expression Trees

Type Safe SelectList Factory

I think that ASP.NET MVC is a huge step forward from ASP.NET Web Forms. Still, there are some parts of it that are disappointing. One is the SelectList constructor, that doesn’t use generics and has string parameters for field selection. To create a SelectList from an IEnumerable<> we would do something like this. IEnumerable<Person> people… Continue reading Type Safe SelectList Factory