Navigation

Categories
Show Navigation Next Topic  »

Code Effects ASP.NET Core 3.0 / Angular Implementation Example

This article provides prerequisites for the ASP.NET Core 3.0 / Angular demo project.

IMPORTANT! To keep the size of the Angular demo project to a minimum, we removed all default node modules normally installed by VS. Download the zip archive from here and unzip it to /ClientApp/ folder if you need them.

Prerequisites

  • Your project must be compiled with at least .NET Core 3.0. To verify, right-click the project node in Solution Explorer, select Properties, select Application tab, and make sure that the Target Framework lists ".NET Core 3.0" or a higher version.
  • Add Rule Editor to your web project by referencing its assemblies from NuGet. Keep in mind that Rule Editor requires different assemblies on different .NET web platforms. The correct NuGet package for Rule Editor on ASP.NET Core 3.0 and up is listed here.
  • Optionally, reference either your licensed assembly of Rule Engine, or the trial assembly from NuGet if you plan to evaluate rules in your web application. Remember that the Engine Trial license delays all calls to Evaluate() and Filter() methods for six seconds.
  • Download Rule Editor's main script from here and save it as /ClientApp/src/assets/js/codeeffects/editor.js. Add a reference to the scripts element inside the /ClientApp/angular.json file:

    "scripts": [ "src/assets/js/codeeffects/editor.js" ]

    This script implements all the client functionality of the Rule Editor. It's self-contained and has no dependencies.

  • Optionally, download the CodeEffects.Common.css file and one of the theme CSS files from here and save them in the /ClientApp/src/assets/css/ folder. Then reference them both in the /ClientApp/angular.json file:

    "styles": [ "src/assets/css/codeeffects/codeeffects.common.css", "src/assets/css/codeeffects/codeeffects.white.css" ]

Implementation

Initialization of the Rule Editor and main functionality of rule management such as rule creation, deletion and loading is implemented in the /ClientApp/src/app/home/ component.

The /Controllers/RuleController.cs controller implements the end points of the rule management.

The app uses the /Models/Patient.cs class as the Source Object of the Rule Editor.

The /Services/StorageService.cs implements the rule storage. It is used by the RuleController to save and retrieve rules to and from the /wwwroot/rules/ folder.

Comments: 0
Post your questions about Code Effects on Stackoverflow and become a part of our growing community