Fixed configuration to allow merge of new data into existing data

This commit is contained in:
TheXamlGuy
2024-10-03 16:35:34 +01:00
parent 855edf7d6d
commit 8136739372
5 changed files with 78 additions and 8 deletions
+25 -1
View File
@@ -22,7 +22,7 @@ public class Component :
return factory.Create<TComponent>(builder);
}
public IComponentBuilder Configure(string? name = null,
public IComponentBuilder Configure(string name,
Action<IComponentBuilder>? builderDelegate = null)
{
if (builderDelegate is not null)
@@ -33,5 +33,29 @@ public class Component :
return Configuring(builder);
}
public IComponentBuilder Configure(Action<IComponentBuilder>? builderDelegate = null)
{
if (builderDelegate is not null)
{
builderDelegate(builder);
}
return Configuring(builder);
}
public IComponentBuilder Configure<TConfiguration>(string name,
TConfiguration? configuration = null,
Action<IComponentBuilder>? builderDelegate = null)
where TConfiguration : class, new()
{
if (builderDelegate is not null)
{
builderDelegate(builder);
}
builder.AddConfiguration(name, configuration);
return Configuring(builder);
}
public virtual IComponentBuilder Configuring(IComponentBuilder builder) => builder;
}