62 lines
1.3 KiB
C#
62 lines
1.3 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace Core.Configurations
|
|||
|
|
{
|
|||
|
|
public class ConfigurationBuilder
|
|||
|
|
{
|
|||
|
|
private readonly List<IConfigurationProvider> _providers = new();
|
|||
|
|
|
|||
|
|
public ConfigurationBuilder AddProvider(IConfigurationProvider provider)
|
|||
|
|
{
|
|||
|
|
_providers.Add(provider);
|
|||
|
|
return this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public IConfigurationRoot Build()
|
|||
|
|
{
|
|||
|
|
// Her kan du implementere din egen sammenlægningslogik
|
|||
|
|
return new ConfigurationRoot(_providers);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class ConfigurationRoot : IConfigurationRoot
|
|||
|
|
{
|
|||
|
|
public ConfigurationRoot(List<IConfigurationProvider> configurationProviders)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public T GetSection<T>(string key)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public static class ConfigurationPredicateExtensions
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public static IConfigurationSection GetSection(this IConfigurationRoot configurationSection, string key)
|
|||
|
|
{
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static T Get<T>(this IConfigurationSection configuration, string key)
|
|||
|
|
{
|
|||
|
|
return default(T);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public interface IConfigurationProvider
|
|||
|
|
{
|
|||
|
|
Dictionary<string, object> Configuration();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public interface IConfigurationSection
|
|||
|
|
{
|
|||
|
|
string Key { get; }
|
|||
|
|
string Path { get; }
|
|||
|
|
string Value { get; set; }
|
|||
|
|
}
|
|||
|
|
}
|