Implementing a Verastream .NET Class Library

The Verastream .NET Class Library is a library of classes and interfaces that comply with the Microsoft .NET Framework SDK. You can add this library as a reference in Visual Studio .NET to access host data and functionality.

.NET Class Library Setup

Prior to using the Verastream .NET Class Library for a production application:

  1. If necessary, rebuild the .NET Class Library project to access the model on the production server:
    1. In Web Builder, open the Project Properties dialog box for the project.
    2. In the Project Properties dialog box, enter the correct server name.
    3. Click Build to regenerate the .NET Class Library using the production server name.
  2. Add the project as a reference in Visual Studio .NET. The <ProjectName>.dll is located in the <documents>\Micro Focus\Verastream\HostIntegrator\projects\<ProjectName>\classlibrary\bin folder.

.NET Class Library Code Example

This example illustrates how to use a Web Builder generated .NET Class Library. The example uses a project named CICSAccts_Class_Library, which generated a .NET Class Library for the CICSAccts model. The GetAccount procedure takes an account number as an input parameter and returns account information.

using System.Data;
using CICSAccts_Class_Library;
// Create an object to represent the session
CICSAccts_Class_LibrarySession session = new CICSAccts_Class_LibrarySession();
// Create an object to hold the filter values
GetAccountFilters filters = new GetAccountFilters();
// Initialize the filters object with the values you want to pass to the host filters.AcctNum = 31415;
// Call the procedure on the session, passing in the filters
DataSet ds = session.GetAccount(filters, null,0);
// Access the data set and process through them
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  {
  Console.WriteLine(ds.Tables[0].Rows[i]["AcctNum"]);
  Console.WriteLine(ds.Tables[0].Rows[i]["LastName"]);
  //...
  }