Amended registration of health check scheduled notifiers (email and Slack) to use a resolver method and allow others to be added without modifying core

This commit is contained in:
AndyButland
2017-06-18 16:41:46 +02:00
parent 01a2ba8ad6
commit 9f68bd4e52
21 changed files with 492 additions and 170 deletions
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.HealthChecks
{
[ConfigurationCollection(typeof(NotificationMethodSettingsElement), AddItemName = "add")]
public class NotificationMethodSettingsElementCollection : ConfigurationElementCollection, IEnumerable<NotificationMethodSettingsElement>
{
protected override ConfigurationElement CreateNewElement()
{
return new NotificationMethodSettingsElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((NotificationMethodSettingsElement)(element)).Key;
}
new public NotificationMethodSettingsElement this[string key]
{
get
{
return (NotificationMethodSettingsElement)BaseGet(key);
}
}
IEnumerator<NotificationMethodSettingsElement> IEnumerable<NotificationMethodSettingsElement>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as NotificationMethodSettingsElement;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}