using Newtonsoft.Json.Linq; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Primitives; using System.Data; namespace Core.Configurations.SmartConfiguration; public class JsonConfiguration : Microsoft.Extensions.Configuration.IConfiguration { private readonly JObject _data; public JsonConfiguration(JObject data) { _data = data; } public string this[string key] { get => _data.SelectToken(key.Replace(":", "."))?.ToString(); set => throw new NotImplementedException(); } public Microsoft.Extensions.Configuration.IConfigurationSection GetSection(string key) => null; //new JsonConfigurationSection(_data, key); public IEnumerable GetChildren() => _data.Properties().Select(p => new JsonConfigurationSection(_data, p.Name)); public IChangeToken GetReloadToken() => throw new NotImplementedException(); IEnumerable IConfiguration.GetChildren() { throw new NotImplementedException(); } }