Hi All
I want to create a custom configuration section to handle email notifications. The configuration needs to be in the following format:
<configSections>
<sectionGroup name="notifications">
<section name="notification" type="NotificationConfiguration" allowLocation="true" allowDefinition="Everywhere" />
</sectionGroup>
</configSections>
...
<notifications>
<notification name="..." enabled="..." delayInMinutes="...">
<recipients>
<add email="..." />
<add email="..." />
<add email="..." />
</recipients>
</notification>
<notification name="..." enabled="..." delayInMinutes="...">
<recipients>
<add email="..." />
<add email="..." />
<add email="..." />
</recipients>
</notification>
</notifications>
...
I can get this to work fine using NotificationConfiguration config = (NotificationConfiguration) ConfigurationManager.GetSection("notifications\notification")
, but this only caters for one <notification>
element. How do I accomplish multiple elements to accommodate more than one notification?
The class that handles this is quite lengthy, so I won't paste it here, but it can be downloaded from here:
http://files.getdropbox.com/u/288235/NotificationConfiguration.cs
Thanks.