This .NET Decision as a Service client library is an SDK for .NET applications to communicate with the Decision as a Service platform easily. This is very similar to the client library in Javascript as shown in a previous post.
As we discussed earlier, using a Decision as a Service platform allows you to simply share the decision module as REST API service. Remember, a decision module may have one or multiple different types of a business logic (i.e., Decision Table, decision flow, Decision Model and Notation (DMN), etc.)


Once you have installed the decision server, you will notice it comes with two client libraries. One is for Javascript clients and the other is for .Net applications.

In your application use NuGet and install the following two components:
1. Json.Net (from Newtonsoft.Json)
2. Microsoft.AspNet.WebAPi.Client

Client library

And finally, from where your server is installed, find FlexRule.Server.ClientLibrary and reference it into your project. This library provides a REST API Client for the Business Rule Server (Decision as a Service) out-of-the-box.

The rest is pretty similar to the Javascript library, so let's now create a simple form as shown below:


And on click event handler of your form just paste the code below:

ExecutionClient.Configuration.MasterServerAddress = "";
var token = ExecutionClient.AcquireToken("app1", "12345678901234567890123456789012");

var response = ExecutionClient.Run(new ExecutionRequest()
    // Authentication token
    Token = token,

    // A correlation identifier for the request, so you know what requests were made for what reason
    // This can be deleted if you don't want to track requests.
    CorrelationId = "12345",

    // values for input parameters of decision
    Inputs = new Dictionary()
        {"car", GetCar()}

    // Address of decision for execution
    Service = "Calculator",
    PackageVersion = "1",
    PackageName = "Car Insurance"

    // strategy to select a service within a package
    UseLatestVersion = true,


if (!response.IsError)
    var result = response.GetValue("car");
    MessageBox.Show(string.Format("Error {0}: {1}", response.MessageId, response.ErrorMessage));

By doing this, your application now connects to the server and returns the result back at the click of a button.

The source code for this application will also be installed on your system when you download and install FlexRule Server.

Read More

  1. .NET Decision as a Service – REST API Client for .Net
  2. JavaScript Decision as a Service – REST API Client for HTML/JS

Last updated September 22nd, 2020 at 11:31 am Published August 10th, 2015 at 08:47 pm