using System.Collections.Generic; using System.Configuration; using Kreta.Core.MessageBroker.Azure.EventHub.Client.Configuration; namespace Kreta.MessageBroker.Configuration { public class EventHubClientConfigurationElementCollection : ConfigurationElementCollection, IEnumerable { #region [Properties] /// /// Collection type /// public override ConfigurationElementCollectionType CollectionType { get { return ConfigurationElementCollectionType.BasicMap; } } /// /// Get element name /// protected override string ElementName { get { return "EventHub"; } } #endregion #region [Private/Protected Methods] /// /// Create new element /// /// Configuration element protected override ConfigurationElement CreateNewElement() { return new EventHubClientConfigurationElement(); } /// /// Get element key /// /// Element /// Element key protected override object GetElementKey(ConfigurationElement element) { return ((EventHubClientConfigurationElement)element).Name; } IEnumerator IEnumerable.GetEnumerator() { var enumerator = base.GetEnumerator(); var eventHubClientConfiguration = new List(); while (enumerator.MoveNext()) { eventHubClientConfiguration.Add((IAzureEventHubClientConfiguration)enumerator.Current); } return eventHubClientConfiguration.GetEnumerator(); } #endregion } }