You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Emre Kara edited this page Sep 20, 2021
·
1 revision
Instances?
If you have any non-static command in your class,
the Custom Commands System needs to have an instance of the class.
There are two ways two get an instance.
1. Default C# way (Activator)
This way is the default one.
Exactly one instance of the class will be created by the Custom Commands System.
To be able to do that, it needs a public parameterless constructor.
2. Dependency Injection way (Microsoft.Extensions.DependencyInjection)
To be able to use this way, you need to set ServiceProviderForInstances in the configs (CustomCommandsSystem.Integration.Settings.Config.ServiceProviderForInstances).
The ServiceProvider will be used to get an instance of the class.
If your class is not registered in the ServiceProvider and has a public parameterless constructor, the 1. way will be used instead.