Generic custom configuration elements collection based on ConfigurationElementCollection

Simple trick thatsaves me some time and coding when writing custom configuration objects is to define generic collection for them. Let’s say Icreated several custom configuration elements derived from my CustomConfigElementBasewhich in turninheritsfrom System.Configuration.ConfigurationElement. Instead of defining collectionsfor each type (derived from ConfigurationElementCollection) I can simply define class:

public class GenericConfigElementCollection<T> : ConfigurationElementCollection

where T : CustomConfigElementBase, new()

{

public T this[int index]

{

get

{

return base.BaseGet(index) as T;

}

set

{

if (base.BaseGet(index) != null)

base.BaseRemoveAt(index);

base.BaseAdd(index, value);

}

}

protected override ConfigurationElement CreateNewElement()

{

returnnew T();

}

protected overrideobject GetElementKey(ConfigurationElement element)

{

return ((T)element).ElementKey;

}

}

Note, that base custom configuration element has property ElementKey to satisfy GetElementKey method implementation. If your custom elements have different keys, you canoverride this property.

Now, when we defineconfiguration section we just return generic collection of appropriate type:

public class MyCustomConfigSection : ConfigurationSection

{

[ConfigurationProperty(“myCustomSettings”, IsRequired = true)]

public GenericConfigElementCollection<MyCustomConfigElement> MyCustomSettings

{

get

{

return this[“myCustomSettings”]

as GenericConfigElementCollection<MyCustomConfigElement>;

}

}

}

And then just use it in anapplication code:

GenericConfigElementCollection<MyCustomConfigElement> configCollection = configSection.MyCustomSettings;

MyCustomConfigSection configSection = (MyCustomConfigSection)ConfigurationManager.GetSection(“mySection”);

BizTalk – Data-driven application host server (?)

Now the BizTalk is recognized and advertized mostly as an Integration server.
There is an architectural pattern for using BizTalk. It is used:
* as an integration engine, as an integration layer between applications (usuallyand as a data transformation layer);
* for the workflow applications (including the long-running workflows);
* as a host for Business Rule Engine applications.
I think the BizTalk Server is more then that.

Let’s think of BizTalk Server as a genericApplication Server.
Now we have the Windows Server OS as an Application Server. We have the IIS as the Application Server.
Windows can host the standalone applications and Windows service applications. We can start the applications by hand, schedule its start by the Scheduled Task utility, setup the special developed applications as the Windows Services.
IIS hosts the Web applications.

Let’s look at the BizTalk Server as a genericApplication Server. Application Server for our usual standalone applications.

The .NET applications can easily start from the Expression shape of the simple Orchestration. There is little redundancy in development.

What the advantages we have using the BizTalk as an Application Server for standalone applications?

Data-driven applications:
Somewhere in the system the data appears. It can be a new file copied in a folder, new file received by FTP, new data in SQL database, new messages in the message queue, new data in the SAP/R3 application, new e-mail. Those data triggered the BizTalk application.
Data is appeared and this starts the appropriate application.
Say a hundred new files appears in the folder (or a hundred rows appeared in the SQL database). And this starts a hundred appropriated applications to concurrently process this data.
This is not easy to implement this data-driven application managementin the usual standalone application.
BizTalk implements many transport and application adapters to transfer data to/from BizTalk applications, like File, FTP, MSMQ, SAP/R3, JD Edwards, etc.

Long-running applications; data correlations:
Say our application sent data to the remote partner then after several minutes or days the partner modified data and sent it back. How can we facilitate the application to wait this response? How can the application survive the server restarts? How can we facilitate the situation when thousand applications are waiting the responses and flooding the server memory? How can we correlate the response data with appropriate application?
BizTalk by design works all these cases.

Scaling up and scaling out:
Having BizTalk as an Application Server the developers can redesign the architecture from big, monolithic application to the small, isolated business-unit application set. BizTalk helps to transfer data between those small applications, helps to correlate data. This ways to high scalable application. Moreover the BizTalk has the intrinsic functionality to manage the high availability and high performance requirements by the special host mechanism.

Yes, it’s true that the data-driven applications get the well-organized data which definitely is the output from other applications. Is that mean we’ve returned to the point where we have gone because it means the old paradigm, the integration level where the BizTalk always was positioned?
The integration tool is the intermediate level tool. It is not the self-independent tool.
But seems the BizTalk is the self-independent Application Serverfor our usual standalone applications.

Any ideas?
Best regards,

Unplugged Events and Live refresh

I am on the road next week presenting on web development enhancements in Visual Studio 2008 (which RTM’s this month!).

Are you doing web development with .NET? Come and see why upgrading to Visual Studio 2008 is a no brainer
With the release of Visual Studio 2008 looming come and join Nigel as he delivers a demo driven talk that shows off many of the new improvements for ASP.NET with .NET 3.5 and VS 2008. Highlights include VS 2008 Multi-Targeting Support, Web Designer and CSS Support, Nested Master Page Support, JavaScript Intellisense and Debugging and many more Code Editing Improvements. If you are doing web development with .NET today come and see why upgrading to Visual Studio 2008 is a no brainer.

There are still a few places left in Auckland, Wellington and Christchurch so register now if you haven’t already!

If you miss these sort of announcements either subscribe to the MSDN announcement feed and/or subscribe to the MSDN Flash newsletter.

Also if I have time I might take the new Windows Live Tools for Visual Studio: CTP for a spin.

Replacing SharePoint application.master page using an HttpModule

Replacing SharePoint application.master page using an HttpModule

Anyone that has customised SharePoint master pages has no doubt come across the problem where system pages won’t use your nice new master page, but rather use the application.master page instead.


The problem with customising the application.master page is that it will affect all sites on your web server farm, rather than just a specific site.


One way to fix this problem is to write an HttpModule that will intercept the calls to these system pages and replace the application.master page with your sites custom master page.


This article explains how to do it:


http://www.sharepointblogs.com/dwise/archive/2007/01/08/one-master-to-rule-them-all-two-actually.aspx

Let me introduce — Sergey Solyanik, ex-dev manager of Widnows Home Server

Sergey was the dev manager of Windows Home Server and one of three people, for whom I decided to leave BizTalk Server and join Windows Home Server team. He is a remarkable person and a friend of mine. Some time ago he left Microsoft for Google, but he is still a remarkable man and a friend of mine! And not far ago he started his own blog!


Here is where he introduces himself: http://softwareandthings.blogspot.com/2007/11/about-myself.html


And here he talks about his experience with Windows Home Server development and his thoughts about comparing Microsoft and Google: http://softwareandthings.blogspot.com/2007/11/intergroup-cooperation.html


I highly recommend his blog and himself. Of course, personally. As Sergey writes in his own blogs:


**This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.**

Managed Services Engine CTP Available on CodePlex

Last week we also announced a CTP release of the Microsoft Managed Services Engine to CodePlex. This is a very powerful set of infrastructure and tools built on WCF for supporting versioning, abstraction, management, routing and runtime policy enforcement of services in a heterogeneous environment. You definitely want to check this out if you are into the provisioning, management, and versioning of enterprise services.


 -Kris

ESB Guidance Released to MSDN!

If you were in either of the two standing room only ESB Guidance sessions at last week conference you heard us mention it would be released shortly. I’m pleased to say that Patterns & Practices has just released the ESB Guidance to MSDN! The MSDN site is the entry point for ESB Guidance bits, docs, and community. This is the culmination of a ton of great work that wouldn’t have been possible without the close collaboration between Microsoft and our community. Thanks to all of you that tested previous versions and provided feedback!


 -Kris