Posts for #Programming

In a recent MSDN TV interview, Mike Clark talked about (and demonstrated) the capabilities of the technology in the System.Transactions namespace, coming in .NET Framework 2.0. In other blog postings, such as in Angel Saenz-Badillos’ posting Whidbey ADO.NET System.Transactions Distributed Transactions and in Florin Lazar’s posting Transactions made easy: System.Transactions I found additional information on the topic. But all those publications have one thing in common: they look at the technology purely from the users’ point of view, not from the point of view of a participant in such a transaction.

Now, especially considering the availability of the new lightweight transaction manager (LTM), I was interested to find out what I’d have to do to be able to take part in a (potentially distributed) transaction with my own objects, as coordinated by System.Transactions. Before I go on describing my findings (and the things I haven’t yet quite understood), let me mention that I have no experience whatsoever with System.EnterpriseServices, so some misunderstandings may certainly be due to my ignorance.

I just stumbled upon a very useful free tool that I didn’t know yet: Wink. Their own description from the website says:

Wink is a Tutorial and Presentation creation software, primarily aimed at creating tutorials on how to use software (like a tutor for MS-Word/Excel etc). Using Wink you can capture screenshots of your software, use images that you already have, type-in explanations for each step, create a navigation sequence complete with buttons, delays, titles etc and create a highly effective tutorial for your users.

In newsgroup post in the Developer Express support newsgroup for their XPO product, I was recently asked if it was possible to show information that’s really stored in a one-to-many relationship as additional columns on the main object. Actually, .NET makes this possible using an implementation of the ITypedList interface together with a custom property descriptor – in this way, arbitrary additional properties on an object can be “simulated”, regardless of the real source of the data. First, let me explain the problem in the sample case (a download link is at the bottom of the post) a little further. Let’s assume you have a class (MasterRecord) that stores a collection of detail values (DetailValue) objects in a typed collection. The following diagram shows the structure, just as an overview of the classes involved:

While I was trying what the best way would be to include C# code in my blog, I found that WordPress has problems with <pre> tags: it inserts <br> and <p> tags all over the place, trying to preserve XHTML validity. While I do like the validity idea, I don’t like the fact that it becomes more or less impossible to use the <pre> tag to publish code.

Looking around, I found the two modules that I need to get back proper <pre> functionality and a little nice highlighting for C#: the Syntax Highlighting with Enscript in WordPress plugin and a highlighting definition file for GNU enscript. These are easy to install together and render results like this (GPL code borrowed from the Linux kernel, drivers/hotplug/cpqphp_core.c):