Version 6 introduces a significant amount of new functionality. This article explains how to upgrade your existing project(s) from any earlier version of Code Effects to the Version 6.0.
Remove all references to existing Code Effects .NET assemblies from every project where you plan to install version 6.
If applicable, uninstall the existing Code Effects npm package.
If applicable, remove the existing Code Effects editor script reference from your project's HTML.
If applicable, remove all existing Code Effects CSS file references from your project's HTML.
Reference the new Code Effects version 6 assemblies either from NuGet or from the Code Effects package you downloaded from our Customer Portal. If necessary, both the Rule Engine and Rule Editor assemblies can be referenced from the same project.
Install or update the latest Code Effects npm package in the web application that will host the Rule Editor.
In web projects that use client-side frameworks such as React or Angular, import the Code Effects editor script from the npm package as a module. Refer to our demo projects for examples. In traditional web applications such as ASP.NET, reference the editor script from the npm package in your HTML as a module using the type="module" attribute:
<script type="module" src="/scripts/codeeffects.editor.js"></script>
Reference the codeeffects.common.css and codeeffects.light.css CSS files from the npm package in your HTML.
Build the project to generate the list of compilation errors.
Update the using directives that reference Code Effects namespaces in all .NET files as follows:
In projects that implement rule management using the editor, replace the following directives:
using CodeEffects.Rule.Asp;
using CodeEffects.Rule.Mvc;
using CodeEffects.Rule.Core;
using CodeEffects.Rule.Web;
using CodeEffects.Rule.Common;
with:
using CodeEffects.Rule.Common.Models;
using CodeEffects.Rule.Editor;
using CodeEffects.Rule.Editor.Models;
using CodeEffects.Rule.Editor.Client;
Replace the following directive:
using CodeEffects.Rule.Attributes;
with:
using CodeEffects.Rule.Common.Attributes;
In projects that implement rule evaluation using the engine, replace the following directives:
using CodeEffects.Rule.Common;
using CodeEffects.Rule.Core;
with:
using CodeEffects.Rule.Common.Models;
using CodeEffects.Rule.Engine;
Some using directives may become unused after these changes. Simply remove them.
The main editor .NET class RuleEditor has been renamed to Control and moved to the CodeEffects.Rule.Editor namespace. Some of its functionality has also been deprecated or renamed:
- Rename all references to the old
CodeEffects.Rule.Web.RuleEditor class to CodeEffects.Rule.Editor.Control.
- Replace any calls to obsolete members of the new
Control class with the members recommended by their Obsolete attributes. Most deprecated members are public methods of the old RuleEditor class that were renamed in the Control class. All deprecated members will continue to work, even if you do not replace them immediately, until the next major version in which we plan to remove them.
Some functionality of the RuleModel class has either been moved to the Control class or deprecated. Starting with Version 6.0, the RuleModel class itself will play a much smaller role:
- Replace any invocations of the
RuleModel.GetRuleXml() public method with Control.GetRuleXml(). For example, replace yourEditor.Rule.GetRuleXml() with yourEditor.GetRuleXml().
- Replace any calls to obsolete members of
RuleModel with the members recommended by their Obsolete attributes.
In your client-side script that initializes the rule editor, replace the following:
- Replace calls to the
yourEditor.setClientActions() public function with the new yourEditor.setCallbacks() function while keeping all parameters the same.
- The callback function that saves your rule is now parameterless. Remove the existing parameter and replace its reference with the
yourEditor.extract() call.