Embedding the Language Rule Editor

  • Updated

Namespaces: InRule.Repository, InRule.Repository.RuleElements, InRule.Authoring.BusinessLanguage,
InRule.Authoring.Controls, InRule.Authoring.Editors, InRule.Authoring.Editors.Controls
Classes:   RuleApplicationDef, LanguageRuleDef, BusinessLanguageEditor, 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 business language 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
ControlFactory controlFactory = new ControlFactory();

// Load ruleapplicationdef
RuleApplicationDef ruleAppDef = RuleApplicationDef.Load(@"c:\work\mortgagecalculator.ruleapp")

// Load the rule application into the control factory

// Get the entity
EntityDef entityDef = ruleAppDef.Entities["Mortgage"];

// Get the language rule to edit
LanguageRuleDef ruleDef =

// Get the business language editor and load into ContentControl
var control = controlFactory.CreateBusinessLanguageEditor(ruleDef);

Saving the changes

// Get the control from the form
if (control is BusinessLanguageEditor)
 // Save the changes back to the rule application
// Dispose of the control if it implements IDisposable
if (control is IDisposable)

// Save the rule application back to the file system (this can also be saved to the Catalog)

Was this article helpful?

0 out of 0 found this helpful



Please sign in to leave a comment.