IPlugin ApiInvoke Method
Invoke a plugin method. This method cannot work with legacy plugins.
Definition
Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.9.8.6
A key-value data collection returned from plugin. Values must be simple type such as string, int, bool, DateTime, etc. User-defined objects are not supported and must be serialized to string before returned to Casewhere.
Assembly: Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.9.8.6
C#
PluginMethodResult Invoke(
string pluginName,
string methodName,
IDictionary<string, Object> parameters
)Parameters
- pluginName String
- Name of the plugin.
- methodName String
- Invoked method name.
- parameters IDictionaryString, Object
- Parameters passed to plugin.
Return Value
PluginMethodResultA key-value data collection returned from plugin. Values must be simple type such as string, int, bool, DateTime, etc. User-defined objects are not supported and must be serialized to string before returned to Casewhere.
Example
C#
// Construct plugin parameters
var parameters = new Dictionary<string, object>();
parameters.Add("$skip", 10);
parameters.Add("$take", 10);
parameters.Add("$sortBy", "Gender");
parameters.Add("$asc", true);
// Invoke plugin method
var pluginApi = ctx.Use<IPluginApi>>();
var pluginResult = pluginApi.Invoke("ExamplePlugin", "SearchCandidates", parameters);
// Retrieve data from plugin results
var total = pluginResult.Get<int>("Total");
var candidates = pluginResult.GetArray("ActualData");