Difference between revisions of "HowTo:Create UBIK Plugin"
(→Example) |
(→Example) |
||
Line 68: | Line 68: | ||
=== Example === | === Example === | ||
<source lang="csharp"> | <source lang="csharp"> | ||
− | |||
[Export(typeof(UBIK.Injection.IUbikPlugin))] | [Export(typeof(UBIK.Injection.IUbikPlugin))] | ||
− | [ExportMetadata("ID", " | + | [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")] |
− | [ExportMetadata("Type", typeof( | + | [ExportMetadata("Type", typeof(TestPlugin))] |
− | [ExportMetadata("Name", " | + | [ExportMetadata("Name", "TestPlugin" )] |
− | [ExportMetadata("Description", " | + | [ExportMetadata("Description", "Tests the injection management")] |
− | [ExportMetadata("Version", | + | [ExportMetadata("Version", 1)] |
[ExportMetadata("MinimumKernelVersion", "2.4.0.0")] | [ExportMetadata("MinimumKernelVersion", "2.4.0.0")] | ||
[ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")] | [ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")] | ||
[ExportMetadata("Company", "Augmensys GmbH")] | [ExportMetadata("Company", "Augmensys GmbH")] | ||
[ExportMetadata("Copyright", "2014, Augmensys GmbH")] | [ExportMetadata("Copyright", "2014, Augmensys GmbH")] | ||
− | public class | + | public class TestPlugin : UBIK.Injection.IUbikPlugin |
{ | { | ||
} | } | ||
− | |||
</source> | </source> | ||
Revision as of 10:53, 19 March 2015
UBIK® Plugins are dynamically loaded into the UBIK® Kernel using the Microsoft Extensibility Framework (MEF).
Contents
Basic Prerequisites
If you want to create a plugin which can be loaded into UBIK® you have to include references to
- System.ComponentModel.Composition
- UBIK.Injection
UBIK® Injection Management provides access to all the basic features used by the Kernel to identifiy and categorize the available plugins. This management is provided by a library called UBIK.Injection.
Interface: UBIK.Injection.IUbikPlugin
The plugin must implement the IUbikPlugin interface and has to be registered for MEF composition by defining the export contract via an attribute.
[Export(typeof(UBIK.Injection.IUbikPlugin))]
public class TestPlugin : UBIK.Injection.IUbikPlugin
{
}
public class TestPlugin : UBIK.Injection.IUbikPlugin
{
}
Interface: IUbikInjectionMetaData
Managing plugins correctly presumes the following information, as defined by the interface UBIK.Injection.IUbikInjectionMetaData.
[ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
[ExportMetadata("Type", typeof(TestPlugin))]
[ExportMetadata("Name", "TestPlugin" )]
[ExportMetadata("Description", "Tests the injection management")]
[ExportMetadata("Version", 1)]
[ExportMetadata("Company", "Augmensys GmbH")]
[ExportMetadata("Type", typeof(TestPlugin))]
[ExportMetadata("Name", "TestPlugin" )]
[ExportMetadata("Description", "Tests the injection management")]
[ExportMetadata("Version", 1)]
[ExportMetadata("Company", "Augmensys GmbH")]
Mandatory information
Name | Type | Description |
---|---|---|
ID | String | Unique ID of the plugin |
Type | System.Type | Systemtype of the plugin; used for filtering the plugins during loading. |
Optional information
Name | Type | Description |
---|---|---|
Name | String | Name of the plugin (for UI Presentation) |
Description | String | Name of the plugin (for UI Presentation) |
Version | Integer | Version of the plugin. As there are more plugins with the same ID, only the plugin with the highest Version is available. |
TargetApplication | PluginTargetApplication | Possibility to limit the plugin for a single type of application. |
MinimumKernelVersion | String | Minimum required Kernel version: Format x.x.x.x |
MinimumDatabaseVersion | String | Minimum required Database version: Format x.x.x.x |
Company | String | Information about the Company (for UI Presentation) |
Copyright | String | Copyright Information (for UI Presentation) |
Example
[Export(typeof(UBIK.Injection.IUbikPlugin))]
[ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
[ExportMetadata("Type", typeof(TestPlugin))]
[ExportMetadata("Name", "TestPlugin" )]
[ExportMetadata("Description", "Tests the injection management")]
[ExportMetadata("Version", 1)]
[ExportMetadata("MinimumKernelVersion", "2.4.0.0")]
[ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")]
[ExportMetadata("Company", "Augmensys GmbH")]
[ExportMetadata("Copyright", "2014, Augmensys GmbH")]
public class TestPlugin : UBIK.Injection.IUbikPlugin
{
}
[ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
[ExportMetadata("Type", typeof(TestPlugin))]
[ExportMetadata("Name", "TestPlugin" )]
[ExportMetadata("Description", "Tests the injection management")]
[ExportMetadata("Version", 1)]
[ExportMetadata("MinimumKernelVersion", "2.4.0.0")]
[ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")]
[ExportMetadata("Company", "Augmensys GmbH")]
[ExportMetadata("Copyright", "2014, Augmensys GmbH")]
public class TestPlugin : UBIK.Injection.IUbikPlugin
{
}