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(NotificationMethodElement), AddItemName = "notificationMethod")]
public class NotificationMethodsElementCollection : ConfigurationElementCollection, IEnumerable<NotificationMethodElement>
{
protected override ConfigurationElement CreateNewElement()
{
return new NotificationMethodElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((NotificationMethodElement)(element)).Alias;
}
new public NotificationMethodElement this[string key]
{
get
{
return (NotificationMethodElement)BaseGet(key);
}
}
IEnumerator<NotificationMethodElement> IEnumerable<NotificationMethodElement>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as NotificationMethodElement;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}