diff --git a/Toolkit.Foundation/ComponentBuilder.cs b/Toolkit.Foundation/ComponentBuilder.cs index 91c6008..6e4f2df 100644 --- a/Toolkit.Foundation/ComponentBuilder.cs +++ b/Toolkit.Foundation/ComponentBuilder.cs @@ -50,7 +50,8 @@ public class ComponentBuilder : public static IComponentBuilder Create() => new ComponentBuilder(); public IComponentBuilder AddConfiguration(Action configurationDelegate) - where TConfiguration : ComponentConfiguration, new() + where TConfiguration : + class, new() { TConfiguration configuration = new(); if (configurationDelegate is not null) @@ -65,7 +66,7 @@ public class ComponentBuilder : public IComponentBuilder AddConfiguration(string section, TConfiguration? configuration = null) where TConfiguration : - ComponentConfiguration, new() + class, new() { hostBuilder.AddConfiguration(section: section, path: ConfigurationFile, defaultConfiguration: configuration); @@ -74,7 +75,8 @@ public class ComponentBuilder : } public IComponentBuilder AddConfiguration(string section) - where TConfiguration : ComponentConfiguration, new() + where TConfiguration : + class, new() { AddConfiguration(section, null); return this; diff --git a/Toolkit.Foundation/ComponentConfiguration.cs b/Toolkit.Foundation/ComponentConfiguration.cs deleted file mode 100644 index 907c0a7..0000000 --- a/Toolkit.Foundation/ComponentConfiguration.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Toolkit.Foundation; - -public record ComponentConfiguration; \ No newline at end of file diff --git a/Toolkit.Foundation/ComponentFactory.cs b/Toolkit.Foundation/ComponentFactory.cs index 25f36e5..9008a73 100644 --- a/Toolkit.Foundation/ComponentFactory.cs +++ b/Toolkit.Foundation/ComponentFactory.cs @@ -13,7 +13,7 @@ public class ComponentFactory(IServiceProvider provider, Action? servicesDelegate = null) where TComponent : IComponent where TConfiguration : - ComponentConfiguration, new() + class, new() { if (provider.GetRequiredService() is TComponent component) { diff --git a/Toolkit.Foundation/ComponentHost.cs b/Toolkit.Foundation/ComponentHost.cs index e679a16..9517e58 100644 --- a/Toolkit.Foundation/ComponentHost.cs +++ b/Toolkit.Foundation/ComponentHost.cs @@ -16,7 +16,7 @@ public class ComponentHost(IServiceProvider services, } public TConfiguration? GetConfiguration() - where TConfiguration : ComponentConfiguration + where TConfiguration : class { return Services.GetService(); } diff --git a/Toolkit.Foundation/IComponentBuilder.cs b/Toolkit.Foundation/IComponentBuilder.cs index ce42434..6034fa0 100644 --- a/Toolkit.Foundation/IComponentBuilder.cs +++ b/Toolkit.Foundation/IComponentBuilder.cs @@ -9,14 +9,14 @@ public interface IComponentBuilder string ContentRoot { get; set; } IComponentBuilder AddConfiguration(Action configurationDelegate) - where TConfiguration : ComponentConfiguration, new(); + where TConfiguration : class, new(); IComponentBuilder AddConfiguration(string section, TConfiguration? configuration = null) - where TConfiguration : ComponentConfiguration, new(); + where TConfiguration : class, new(); IComponentBuilder AddConfiguration(string section) - where TConfiguration : ComponentConfiguration, new(); + where TConfiguration : class, new(); IComponentBuilder AddServices(Action configureDelegate); diff --git a/Toolkit.Foundation/IComponentFactory.cs b/Toolkit.Foundation/IComponentFactory.cs index c6c63e4..aa50763 100644 --- a/Toolkit.Foundation/IComponentFactory.cs +++ b/Toolkit.Foundation/IComponentFactory.cs @@ -9,5 +9,5 @@ public interface IComponentFactory Action? builderDelegate = null, Action? servicesDelegate = null) where TComponent : IComponent - where TConfiguration : ComponentConfiguration, new(); + where TConfiguration : class, new(); } \ No newline at end of file diff --git a/Toolkit.Foundation/IComponentHost.cs b/Toolkit.Foundation/IComponentHost.cs index fe46212..75586bf 100644 --- a/Toolkit.Foundation/IComponentHost.cs +++ b/Toolkit.Foundation/IComponentHost.cs @@ -5,5 +5,7 @@ namespace Toolkit.Foundation; public interface IComponentHost : IHost { - TConfiguration? GetConfiguration() where TConfiguration : ComponentConfiguration; + TConfiguration? GetConfiguration() + where TConfiguration : + class; } \ No newline at end of file