This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
namespace Kreta.Core.FeatureToggle.Configuration
{
public class SimpleFeatureConfiguration : ConfigurationElement
{
[ConfigurationProperty(nameof(Name), IsKey = true, IsRequired = true)]
public string Name => base[nameof(Name)].ToString();
[ConfigurationProperty(nameof(IsEnabled), IsKey = false, IsRequired = true)]
public bool IsEnabled => bool.Parse(base[nameof(IsEnabled)].ToString());
[ConfigurationProperty(nameof(InstituteIds), IsKey = false, IsRequired = false)]
[TypeConverter(typeof(CommaDelimitedStringCollectionConverter))]
public IEnumerable<string> InstituteIds
{
get
{
var instituteIds = ((CommaDelimitedStringCollection)base[nameof(InstituteIds)]);
return (instituteIds != null) ? instituteIds.OfType<string>() : new List<string>();
}
}
[ConfigurationProperty(nameof(Environments), IsKey = false, IsRequired = false)]
[TypeConverter(typeof(CommaDelimitedStringCollectionConverter))]
public IEnumerable<string> Environments
{
get
{
var environments = ((CommaDelimitedStringCollection)base[nameof(Environments)]);
return (environments != null) ? environments.OfType<string>() : new List<string>();
}
}
}
}