encyption wip

This commit is contained in:
TheXamlGuy
2024-04-29 21:42:04 +01:00
parent 7e980dbfce
commit b89f21b3ca
5 changed files with 20 additions and 19 deletions
+1 -3
View File
@@ -1,5 +1,3 @@
namespace Toolkit.Foundation;
public record ComponentConfiguration
{
}
public record ComponentConfiguration;
+5 -3
View File
@@ -7,9 +7,11 @@ public class ComponentFactory(IServiceProvider provider,
IComponentScopeCollection scopes) :
IComponentFactory
{
public IComponentHost? Create<TComponent>(string name,
ComponentConfiguration configuration, Action<IServiceCollection>? servicesDelegate = null)
public IComponentHost? Create<TComponent, TConfiguration>(string name,
TConfiguration configuration,
Action<IServiceCollection>? servicesDelegate = null)
where TComponent : IComponent
where TConfiguration : ComponentConfiguration, new()
{
if (provider.GetRequiredService<TComponent>() is TComponent component)
{
@@ -43,7 +45,7 @@ public class ComponentFactory(IServiceProvider provider,
}
});
builder.AddConfiguration(name, configuration);
builder.AddConfiguration<TConfiguration>(name, configuration);
IComponentHost host = builder.Build();
scopes.Add(new ComponentScopeDescriptor(name,
+4 -3
View File
@@ -4,7 +4,8 @@ namespace Toolkit.Foundation;
public interface IComponentFactory
{
IComponentHost? Create<TComponent>(string name,
ComponentConfiguration configuration, Action<IServiceCollection>? servicesDelegate = null)
where TComponent : IComponent;
IComponentHost? Create<TComponent, TConfiguration>(string name,
TConfiguration configuration, Action<IServiceCollection>? servicesDelegate = null)
where TComponent : IComponent
where TConfiguration : ComponentConfiguration, new();
}
-10
View File
@@ -1,10 +0,0 @@
namespace Toolkit.Foundation;
public record Initialized<TValue>(TValue Value);
public record Initialized
{
public static Initialized<TValue> As<TValue>(TValue value) => new(value);
public static Initialized<TValue> As<TValue>() where TValue : new() => new(new TValue());
}
+10
View File
@@ -0,0 +1,10 @@
namespace Toolkit.Foundation;
public record Open<TValue>(TValue Value);
public record Open
{
public static Open<TValue> As<TValue>(TValue value) => new(value);
public static Open<TValue> As<TValue>() where TValue : new() => new(new TValue());
}