What Was I Thinking?

Follies & Foils of .NET Development
posts - 86 , comments - 254 , trackbacks - 0

October 2009 Entries

QuickTip: Attach the VS Debugger to IIS’s Worker Process in a single keystroke
I’ve been spending a lot of time lately debugging through some web-hosted applications. Some of these applications are hosted by Visual Studio’s own internal web server (Cassini), and others are hosted by my local instance of IIS. Web projects hosted locally get automatic attached to the VS debugger when you press F5. Projects hosted under IIS do not. In order to debug IIS hosted projects, you must attach the Visual Studio debugger to the IIS worker process (aspnet_wp.exe or w3wp.exe) manually. Traditionally, ......

Posted On Friday, October 30, 2009 8:45 AM | Comments (3) |

QuickTip: Did You Know??? Auto-Adding Dictionary entries
When adding an item to a dictionary, I always thought you had to use the Add() method, like this: string key = "MyKey";int value = 20;var myDictionary = new Dictionary<string, int>();myDictionary.Add(... value); Apparently, you can directly reference it in the collection, and if the key doesn’t exist, its auto-added to the collection string key = "MyKey";int value = 20;var myDictionary = new Dictionary<string, int>();myDictionary[key] = value; most likely you already knew this. I did ......

Posted On Monday, October 19, 2009 4:21 AM | Comments (2) |

Using Resharper with RIA Services.
I’m a big fan of Resharper. Its loaded with refactoring and best practice guidance that makes me a better developer. I’ve also started working with .NET RIA services. The verdict is still out on RIA services, but I think I like them. Unfortunately RIA has an interesting approach to code sharing between the web and Silverlight project that's incompatible with Resharper. It used generated code that is technically excluded from the project. As a result, any code in my Silverlight project that references ......

Posted On Monday, October 12, 2009 8:35 AM | Comments (2) |

Open XAP files using Windows Explorer
Silverlight bundles its executables into a single file with a XAP extension. This is really just a zip file. You can open the XAP and modify the contents just as you would any ZIP file. By default windows explorer doesn’t know how to open XAP files. The following reg file adds the metadata to tell Explorer to treat XAP files like compressed folders. I found this file somewhere on the internet, my apologies for not being able to site the source. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.xap] ......

Posted On Sunday, October 11, 2009 9:25 PM | Comments (4) |

Using Dynamic Linq in Silverlight Projects
Recently I had the need to implement support for Dynamic Linq queries in my framework project. For the uninitiated, Dynamic Linq allows me to write statements like this: var query = db.Customers.Where("City == @0 and Orders.Count >= @1", "London", 10). OrderBy("CompanyName"). Select("New(CompanyName as Name, Phone)"); where I can specify the predicates and selectors as string values. Microsoft has published a helper class that enables DynamicLinq support here -->C# Dynamic Query Library (included ......

Posted On Saturday, October 10, 2009 11:41 AM | Comments (16) |

Silverlight (3) ComboBox binding made easy.
Manish Dalal wrote an excellent post on how to effectively data bind a silverlight combobox for foreign key scenarios. Using his approach, you create a ListProvider class that receives a DomainContext, internally loads the data into the context, and exposes the loaded data through an easily bound property. Having written a few of these, I’ve refactored the list provider functionality to a generic base class. The heavy lifting is done via reflection and it should be noted that my code assumes you ......

Posted On Thursday, October 1, 2009 6:52 PM | Comments (8) |

Powered by: