[Plugin system] Move filters to dependency injection.

This commit is contained in:
2023-10-05 16:00:59 +01:00
parent b27d0c1f03
commit 24d1702838
37 changed files with 229 additions and 232 deletions

View File

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