October 2008 Entries

How to Debug Windows Service

Sometimes windows service debugging is really tricky. Usually , during development, developer should implement some test harness application with UI to run and test functionality being developed. But when it comes to debug real windows service which hosts the objects which do the real job - it's a headache. Amazingly, in NET platform there is a simple and straightforward way to debug a windows service. Consider the following code sample: using System.ServiceProcess; namespace MyService { public partial...

Factory Design Pattern

Today I will show how to implement factory design pattern in NET platform. One type of pattern that we see again and again in OO programs is the Factory pattern. A Factory pattern is one that returns an instance of one of several possible classes, depending on the data provided to it. Consider the following C# code sample: using System; using System.Runtime.Remoting; namespace Factory { /// /// implements factory design pattern /// public static class WorkerFactory { private static string _asmName...