Configurable Controller
NFive.SDK.Server.Controllers.ConfigurableController<T : IControllerConfiguration>
NFive also provides ConfigurableController<T>
, a subclass of Controller
, for convenience. The configurable controller allows you to supply a model type which will automatically be used as the plugin's configuration object and be loaded from a YAML file.
Constructor
ConfigurableController<T>(ILogger logger, IEventManager events, IRpcHandler rpc, IRconManager rcon, T configuration)
The configurable controller constructor is the same as the standard controller except that the 5th argument will be an instance of the provided configuration type. This instance is created by NFive deserializing the plugin YAML configuration file at startup, which is stored in a local property this.Configuration
.
Methods
The configurable controller has the same methods as the standard controller except for Reload()
.
Reload()
public virtual void Reload(T configuration)
Triggered by user request, this method should run code to reset and reload any plugin configuration or cache.
The configurable controller is provided with a freshly loaded configuration object and by default updates the local configuration property.