SimpleInjector is now used to provide DI for mods. Mods may request services provided by PPML by placing them as constructor parameters. PPML will attempt to resolve the dependencies and provide them to the mod during construction.
Recommended best practice is to store the injected services and only make use of them in the Initialize() function so as to prevent unintended behavior when constructing mods.
See the EnableConsoleAccess mod for an example.
Currently only one service is made available to mods, the IFileConfigProvider. This is implemented by the JsonFileConfigProvider as an easy way to read and dump configuration objects. JSON isn't necessarily the format I'm settling on permanently as it's not the most user friendly. However, it's developer-friendly and I'm trying to make some progress.
SimpleInjector is now used to provide DI for mods. Mods may request services provided by PPML by placing them as constructor parameters. PPML will attempt to resolve the dependencies and provide them to the mod during construction.
Recommended best practice is to store the injected services and only make use of them in the
Initialize()
function so as to prevent unintended behavior when constructing mods.See the
EnableConsoleAccess
mod for an example.Currently only one service is made available to mods, the
IFileConfigProvider
. This is implemented by theJsonFileConfigProvider
as an easy way to read and dump configuration objects. JSON isn't necessarily the format I'm settling on permanently as it's not the most user friendly. However, it's developer-friendly and I'm trying to make some progress.