encyption wip
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
namespace Toolkit.Foundation;
|
namespace Toolkit.Foundation;
|
||||||
|
|
||||||
public record ComponentConfiguration
|
public record ComponentConfiguration;
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -7,9 +7,11 @@ public class ComponentFactory(IServiceProvider provider,
|
|||||||
IComponentScopeCollection scopes) :
|
IComponentScopeCollection scopes) :
|
||||||
IComponentFactory
|
IComponentFactory
|
||||||
{
|
{
|
||||||
public IComponentHost? Create<TComponent>(string name,
|
public IComponentHost? Create<TComponent, TConfiguration>(string name,
|
||||||
ComponentConfiguration configuration, Action<IServiceCollection>? servicesDelegate = null)
|
TConfiguration configuration,
|
||||||
|
Action<IServiceCollection>? servicesDelegate = null)
|
||||||
where TComponent : IComponent
|
where TComponent : IComponent
|
||||||
|
where TConfiguration : ComponentConfiguration, new()
|
||||||
{
|
{
|
||||||
if (provider.GetRequiredService<TComponent>() is TComponent component)
|
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();
|
IComponentHost host = builder.Build();
|
||||||
|
|
||||||
scopes.Add(new ComponentScopeDescriptor(name,
|
scopes.Add(new ComponentScopeDescriptor(name,
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ namespace Toolkit.Foundation;
|
|||||||
|
|
||||||
public interface IComponentFactory
|
public interface IComponentFactory
|
||||||
{
|
{
|
||||||
IComponentHost? Create<TComponent>(string name,
|
IComponentHost? Create<TComponent, TConfiguration>(string name,
|
||||||
ComponentConfiguration configuration, Action<IServiceCollection>? servicesDelegate = null)
|
TConfiguration configuration, Action<IServiceCollection>? servicesDelegate = null)
|
||||||
where TComponent : IComponent;
|
where TComponent : IComponent
|
||||||
|
where TConfiguration : ComponentConfiguration, new();
|
||||||
}
|
}
|
||||||
@@ -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());
|
|
||||||
}
|
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user