More work in this Configuration Manager
This commit is contained in:
parent
8e6492e979
commit
21d7128e74
11 changed files with 299 additions and 79 deletions
61
Core/Configurations/ConfigurationBuilder.cs
Normal file
61
Core/Configurations/ConfigurationBuilder.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
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; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue