sept. 24
We have seen how to create and to deploy a windows service in C#. However this post was explaining how to use to the designer functionality to deploy our service. This is not really a problem (who wants to do himself what has already been done by another one ?) but it has a "huge" drawback. This installer needs to be next to our service. And who on earth really want to find in a same place the production code (ie the service) and the deployment code (ie the installer) ? The next step would probably to add some test code, and then...

So we will see here how we can create the installer class in a separate DLL.

We will also see what to do when you get the "Error 193 0xc1" meaning "The Service service failed to start due to the following error : My Service is not a valid Win32 application." [Plus]
sept. 22
Let's say we have the following specifications :

- We want an application that will turn continuously on a machine
- This application shall require no manual interaction (starting automatically)
- This application shall monitor a specific folder on the file

The specifications are very simple and we will probably start thinking to a windows service that would be launched in an automatic manner. This service could then use a FileSystemWatcher to do its job.

We'll see in this post how we can create this service and how to start / stop the FileSystemWatcher in the OnStart and OnStop event of the service, and to parameter it, specifying the properties NotifyFilter and EnableRaisingEvents.
We'll also see how we can install the service and specify that it will start automatically on each startup of Windows.

Finally we'll give some extra links to be able to customize the behavior of the service. [Plus]
juin 02
Recently, one of my colleague wanted to call an auto-implemented property setter in a class' constructor.
I do not think this is a good idea as we don't know how the class may evolve in the future.
In this post, I will show some of possible evolutions that make me think that we should not use auto-implemented properties in a class' constructor, but rather use a classical property and thus the member variable. [Plus]
Tags: | | | |
mai 10
I recently wrote a post describing the use of control adapters to adapt the rendering of a control
However there are special things to know where we use control adapters with validators (ie controls deriving - directly or not - from BaseValidator), unless what the rendering result may be far from the one expected. [Plus]
Tags: | | | |
avr. 23
Depending of the browser, some control may need to be rendered differently. By default the .NET framework works with "Control Adapters", id est, some classes that will be plugged into the rendering process.

How does it works ? When the server receives a request, it will try to find which browser does the request, based on the user agent or on HTTP headers for example. To do it rely on some browser definition files (of extension .browser). To see them, please go on %windir%/Microsoft.NET/Framework//CONFIG/Browsers.

When the server has identified the browser (at worse, it would be identified as a "Default" browser), and that it needs to render a control, it will look if there is some control adapters plugged for this kind of control. If there are some, they will be in charge of the rendering. If not, the control will render himself. Note that an adapter can redirect / delegate some treatment to the control.

In this post, I will show
- how to create a basic control adapter
- how to use the adapter in a website (ie how to create a ".browser" file)
- how we can use this for testing purpose (by adapting the user agent used for testing requests) [Plus]
Tags: | | | |