Asynchronously execute a Business Logic Tier (BLT) component using the Data Access Layer (DAL)
- Last UpdatedApr 08, 2026
- 3 minute read
This scenario guides you through the steps required to asynchronously execute the TestBLT Business Logic Tier (BLT) component using the Data Access Layer (DAL) .
To identify the code associated with each step, see to the code comments in the Example code section.
The TestBLT component is called using the following input parameters:
- table and point names
- numberOfAlarms
The TestBLT component returns the following outputs:
- numberOfAlarms parameter
- numberOfEvents parameter
- table and point names are returned as a tabular result or dataset
Toasynchronouslyexecute the BLT component using the DAL
- Open the Program.cs file from the created project.
In this example, the project is named DALBLTTest and the BLT component is named TestBLT.
- Create the method that implements DALBLTConnection.DALBLTExecuteDelegate by doing the following:
- Handle the execution status.
- Retrieve the result data.
- Retrieve the output values of the parameters.
- Create a new method to execute the BLT component by doing the following:
- Get a DALBLTConnection to the driver where the BLT component is hosted. For example, RealTime.
- Create the BLT component parameters, providing initial values for the input parameters and output variable for the output parameters.
- Execute the BLT component asynchronously.
- On the Main method, do the following:
- Initialize the DAL client service layer.
- Call the BLT component execution asynchronous method.
- Wait for the response and the delegate execution.
- Run the DALBLTTest.exe to check the DALBLTTest component execution by doing the following:
- On the desktop, double-click the Windows PowerShell for DNA shortcut.
- Execute the following commands:
set-silo RealTime
dalblttest
Example code
// Create the method that implements DALBLTConnection.DALBLTExecuteDelegate.
private static void GetAsynchronousResults(
List<DALBLTParam> bltParamList,
Int32 rowsAffected,
DataSet data,
DALBLTExecutionStatus executionStatus,
Object clientObj,
String failureReason)
{
// Handle the execution status.
if (executionStatus == DALBLTExecutionStatus.Success)
{
lock (resultLock)
{
// Retrieve the result data.
var table = data.Tables[0];
foreach (DataRow row in table.Rows)
{
var name = row[0].ToString();
var value = row[1].ToString();
Console.WriteLine(quot;The result field {name} result has value {value}.");
}
// Retrieve the output values of the parameters.
foreach (var param in bltParamList)
{
if (param.IsOutput)
{
Console.WriteLine(quot;The parameter {param.Name} has value {param.Value}.");
}
}
}
}
else if (executionStatus == DALBLTExecutionStatus.CreateFailed)
{
Console.WriteLine(quot;Failed to create a BLT component: {failureReason}.");
}
else if (executionStatus == DALBLTExecutionStatus.ExecutionFailed)
{
Console.WriteLine(quot;Failed to execute BLT component: {failureReason}.");
}
else
{
Console.WriteLine(quot;Unknown execution status received while processing results: {executionStatus}.");
}
}
private static void AsynchronousExecute()
{
// Get a DALBLTConnection to the driver where the BLT component is hosted.
var bltConnection = DALBLTClient.GetGlobalConnection("Realtime", null);
// Create BLT component parameters.
var bltParameters = new List<DALBLTParam>
{
new DALBLTParam(name:"point", value:"0analog", isOutput: false),
new DALBLTParam(name:"table", value:"analog", isOutput: false),
new DALBLTParam(name:"numberOfAlarms", value:100, isOutput: true),
new DALBLTParam(name:"numberOfEvents", value:null, isOutput: true),
};
var bltValues = new List<DALBLTParam>();
const String bltName = "TestBLT";
const Int32 maxRowsToReturn = 0; // unlimited rows.
// Execute the BLT component asynchronously.
var request = bltConnection.Execute(
bltName,
maxRowsToReturn,
bltParameters,
GetAsynchronousResults,
null);
}
static void Main(String[] args)
{
// Initialize the DAL client service layer.
DALService.Initialize();
// Call the BLT component execution asynchronous method.
AsynchronousExecute();
// Wait for the response and the delegate execution.
Console.ReadLine();
}