-
Notifications
You must be signed in to change notification settings - Fork 63
Writing a custom module
Jan Lenoch edited this page Aug 28, 2018
·
8 revisions
Creating a new KInspector module requires two basic things:
- Creating a class implementing the KInspector.Core.IModule interface.
- Placing this class within the KInspector.Modules project
All implementations of IModule interface are automatically discovered at runtime and displayed in the UI.
The interface contains two methods:
-
GetModuleMetadata - returns
ModuleMetadata
object that consists of module name, its description and list of supported Kentico versions -
GetResults - returns
ModuleResults
object with actual results (can be e.g. aDataTable
) and a status code. As an example, take a look at the implementation of the Application restarts module.
You should always provide users with sufficient and relevant information on what the module does and how to interpret the results (either by including your own description or via external links). Put these information to ModuleMetadata.Comment
property.
When developing new modules within the KInspector.Modules project, follow the following file structure:
- SQL Script
- .\Scripts folder or subfolder
- In the file's properties, don't forget to set Copy to Output Directory to Copy Always
- C# module code
- .\Modules folder or subfolder
- Probe file
- .\ProbeData folder or subfolder
- In the file's properties, don't forget to set Copy to Output Directory to Copy Always and set the Build Action to Content.