Prerequisites: A valid RuleSession
Namespaces: InRule.Runtime
Classes: RuleSession, RuleException
See Also: Retrieving a Rule Application, Creating a RuleSession, Handling Exceptions
References: InRule.Runtime.dll, InRule.Common.dll
Execute decision using DecisionInput
try
{
// Execute the Decision
var decision = session.CreateDecision("CalculateArea");
decision.Execute(new DecisionInput("height", 30), new DecisionInput("width", 400));
}
catch (RuleException ex)
{
// Handle any rule engine exceptions here.
Console.WriteLine(ex.ToString());
}
Note: If a Decision input is an Entity type, an Entity instance should be passed. Any Auto RuleSets, calculations, constraints and classifications on the passed Entity will be executed.
Execute decision using JSON
try
{
// Execute the Decision
var decision = session.CreateDecision("CalculateArea");
decision.Execute("{ \"height\": 30, \"width\": 400 }, EntityStateType.Json));
}
catch (RuleException ex)
{
// Handle any rule engine exceptions here.
Console.WriteLine(ex.ToString());
}
Comments
0 comments
Please sign in to leave a comment.