[Plugin system] Move partitions to dependency injection.

This commit is contained in:
2023-10-05 16:11:12 +01:00
parent 24d1702838
commit e00af2a93f
3 changed files with 25 additions and 28 deletions

View File

@@ -195,16 +195,14 @@ public class PluginRegisterGenerator : ISourceGenerator
if(partitionPlugins?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllPartitionPlugins() => new()");
sb.AppendLine(" public void RegisterPartitionPlugins(IServiceCollection services)");
sb.AppendLine(" {");
foreach(string plugin in partitionPlugins)
sb.AppendLine($" typeof({plugin}),");
sb.AppendLine(" };");
sb.AppendLine($" services.AddTransient<IPartition, {plugin}>();");
sb.AppendLine(" }");
}
else
sb.AppendLine(" public List<Type> GetAllPartitionPlugins() => null;");
sb.AppendLine(" public void RegisterPartitionPlugins(IServiceCollection services) {}");
sb.AppendLine();