Enable components to create new components

This commit is contained in:
TheXamlGuy
2024-10-07 14:42:04 +01:00
parent 4d24b43280
commit ae8d62ceb2
2 changed files with 10 additions and 4 deletions
+6
View File
@@ -20,6 +20,12 @@ public class ComponentFactory(IServiceProvider provider,
builder.AddServices(services =>
{
services.AddTransient(_ =>
provider.GetRequiredService<IProxyServiceCollection<IComponentBuilder>>());
services.AddTransient(_ =>
provider.GetRequiredService<IComponentFactory>());
services.AddTransient(_ =>
provider.GetRequiredService<IProxyService<IPublisher>>());
+3 -3
View File
@@ -53,10 +53,10 @@ public class DefaultHostBuilder :
services.AddScoped<INavigation, Navigation>();
services.AddSingleton(new NamedComponent("Root"));
services.AddScoped<IComponentScopeCollection, ComponentScopeCollection>(provider => new ComponentScopeCollection
{
services.AddScoped<IComponentScopeCollection, ComponentScopeCollection>(provider =>
[
new ComponentScopeDescriptor("Root", provider.GetRequiredService<IServiceProvider>())
});
]);
services.AddTransient<IComponentFactory, ComponentFactory>();
services.AddTransient<IComponentScopeProvider, ComponentScopeProvider>();