Integration

From FlexRule Wiki
Jump to: navigation, search

Integration

Integration is as simple as:

  1. Referencing assemblies
  2. Using the RuntimeEngine type to load and execute logic(Rules, flow, decision, NL...)

Referencing Assemblies

You need to reference the following core assemblies:

  • FlexRule.Core.Element.dll
  • FlexRule.Core.Library.dll
  • FlexRule.Engine.dll
  • FlexRule.Procedure.dll

And based on type of logic you may need, one or more of the following assemblies

  • FlexRule.Validation.dll: Validation, Decision, Natural Language
  • FlexRule.Decisions.dll: Decision table (This requires FlexRule.Validation.dll as well)
  • FlexRule.Flows.dll: Flow orchestration
  • FlexRule.Flows.Workflow.dll: Workflow (This requires FlexRule.Flows.dll as well)

Load and Execution

After referencing the required assembly in your application, executing a logic in FlexRule requires 2 simple steps:

  1. Creating a Runtime Engine instance
  2. Calling the engine by providing values for input parameters (if required)

More details

Handling Exceptions

When you load and/or execute rules, you may face some exceptions. To get the full understanding of the exception details you can use ExceptionCenter

 try 
 {    
    // do stuff 
 } 
 catch(Exception ex) 
 {
    string error = FlexRule.ExceptionCenter.GetExceptionString(ex); 
    // send support@flexrule.com this error when required
 }

The error variable has details information of full rule execution stack trace.

Use Glossary

Business glossaries must be referenced as part of your rule execution if

  1. Running Decision table that has Term in conditions instead of expression
  2. Using Natural Language that uses business glossary to introduce terms

More details

Modeling Logic

There are many different ways to model a business logic (i.e. rules, decisions, flows...). For more details please check Logic.