April 2010 Entries

Cancelling Selection Change in a Bound WPF Combo Box

Scenario A user selects a new value from a WPF combo box. You ask if they are sure they want to do this. User says “No”. WPF app is built with MVVM such that the combo box’s SelectedItem is bound to a property on the ViewModel. In the setter, you prompt the user and attempt to cancel the selection by discarding the new selected value. Here’s the UI XAML <Window x:Class="WpfComboBoxCancelSelect.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Cancellable...

posted @ Sunday, April 25, 2010 4:38 PM | Feedback (17)

I <3 LinqKit – Dynamically build arbitrarily complex Linq Queries

In some cases, I need to be able to build a query that has a variable set of OR conditions. This is not simple with the default language constructs and extension methods. It’s simple to dynamically build an expression that includes AND parameters, because that is what the WHERE() extension method does. Not so easy for OR’ing together a bunch of conditions. Enter LinqKit. This is a great library. It provides some easy to use (but powerful) extension methods that let you “Or()” some conditions together. A common case is where you get a list of values that you need to add into...

posted @ Wednesday, April 14, 2010 11:42 AM | Feedback (0)

Entity Framework 4.0 doesn’t enforce MaxLength metadata

I’m a little flabbergasted that Entity Framework does not do anything to enforce the MaxLength on string values. It just passes this responsibility down to the database and catches the resulting (unhelpful) exceptions. I suppose that there is a justification for this, but from an notably simplistic perspective… Why should I start a transaction and waste precious DB resources, only to get some generic “String or binary data may be truncated” error message back. It would be trivial for EF to use the metadata to ensure that you cannot push a 10 character string into a field that...

posted @ Tuesday, April 13, 2010 3:42 PM | Feedback (3)

VS 2010 Premium RTM – Got It!

After a couple hiccups with the download yesterday, I finally got the bits and got VS 2010 Premium installed. Great stuff! I’m glad to be running this on the host again, rather than a VM. I can take advantage of multi-monitor, GPU acceleration, and better speed! Hotness! My current project is using TFS Power Tools for the check-in policies. My searching indicates that RTM versions are not available yet. So, I’m hoping that the TFS Power Tools RC bits will do for now. As far as I can tell, it’s working so far. My work item policy, comments, and...

posted @ Tuesday, April 13, 2010 8:04 AM | Feedback (0)

Visual Studio 2010 Launches Today!

As far as I can tell, MS is launching VS 2010 today. I’m hoping that means that I can get my hands on the RTM bits. I’ve already checked MSDN, but all they have as of 10AM Easter time is the RC. Can’t wait for RTM so that I can put it on my host instead of running it in a virtual machine! Cheers!

posted @ Monday, April 12, 2010 10:16 AM | Feedback (0)

I <3 Windows Home Server

In speaking with a colleague today, I realized that I had not blogged about Windows Home Server. So, here is my much belated post…. The problem… About a year ago, I decided that I was tired of the hassle and headache of personal data backup. I have pictures, videos, music, documents, etc. Copying this to a CDR doesn’t work. Even a DVD is too small. Backing up to a second hard drive is an option, but still requires my attention. I had tried some “cloud” storage services (like XDrive before AOL bought it and dumped it… grrrr!). These were kind of...

posted @ Saturday, April 03, 2010 5:03 PM | Feedback (1)