40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
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>();
|
|
}
|
|
}
|
|
}
|
|
}
|