Namespaces: InRule.Repository, InRule.Repository.RuleElements, InRule.Authoring.BusinessLanguage,
InRule.Authoring.Controls, InRule.Authoring.Editors,
InRule.Authoring.Editors.Controls, InRule.Repository.DecisionTables
Classes: RuleApplicationDef, DecisionTableControl, ControlFactory
See Also: Opening a RuleApplicationDef for Authoring, WinForm Considerations
References: InRule.Repository.dll, InRule.Authoring.dll, InRule.Authoring.BusinessLanguage.dll, InRule.Authoring.Editors.dll, InRule.Common.dll
Loading the decision table editor into a ContentControl
The following code works in WPF. Loading the control in this manner will only load the control, the Name and Enabled fields will not be present. To embed the entire control see here.
// Create an instance of the control factory (consider keeping this at form level to reuse where
appropriate)
ControlFactory controlFactory = new ControlFactory();
// Load ruleapplicationdef
RuleApplicationDef ruleAppDef = RuleApplicationDef.Load(@"c:\work\invoice.ruleapp");
// Get the entity
EntityDef entityDef = ruleAppDef.Entities["Mortgage"];
// Get the decision table to edit
DecisionTableDef decisionTableDef =
(DecisionTableDef)entityDef.GetRuleSet("InvoiceRules").Rules["CommissionTable"];
// Load decision table editor into content control
var control = controlFactory.CreateDecisionTableControl(decisionTableDef);
Saving the changes
// Changes from the decision table control are automatically saved back to the rule app
// So we are just going to save rule app to file system (or Catalog if desired)
ruleAppDef.SaveToFile(@"c:\work\invoice.ruleapp");
Comments
0 comments
Please sign in to leave a comment.