E-posta bildirimlerini işlemek için özel bir yapılandırma bölümü oluşturmak istiyorum.Özel ASP.NET Yapılandırma Bölüm
<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>
...
Bu ince NotificationConfiguration config = (NotificationConfiguration) ConfigurationManager.GetSection("notifications\notification")
kullanarak çalışmak için alabilirsiniz, ama bu sadece bir <notification>
eleman hitap: yapılandırma aşağıdaki biçimde olması gerekir. Birden fazla bildirimi birden fazla bildirimi karşılamak için nasıl yapabilirim?
bu oldukça uzun olduğunu kolları sınıf, bu yüzden buraya yapıştırın olmaz, ancak buradan indirilebilir:
http://files.getdropbox.com/u/288235/NotificationConfiguration.cs
teşekkür ederiz.
Bir dış öğesi oluşturabilir ve tüm bildirim öğelerinizi bu grubun içine koyabilirsiniz. Bu şekilde, elde etmek istediğiniz şeyi elde edebileceksiniz. –
Kirtan
Güncellenmiş cevabımı kontrol et. – Kirtan