roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2

Home Page:https://docs.cssharp.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ability to inject IPluginConfig<T>

busheezy opened this issue · comments

It would be great to be able to inject our config into different services.

This is difficult due to the nature of the OnConfigParsed method which sets an instance of config onto the base plugin after instantation, which occurs much later than service collection creation. We can put the type T from IPluginConfig<T> in the container, but it will not have any modifications that are processed by OnConfigParsed. How does that solution fare?

This would be solved in #400 if we go ahead with the solution.

Let me know what you think.