IRtConnection.GetList<T> Method (String)

The GetList<T> Method (String) returns a list of T elements for a specified list name and type. The type specifier in the GetList<T> definition specifies the type of list template as defined in System Modeler. For example, if you define a List template in System Modeler, named NameIdInfo and it contains the attributes “Id” and “Name”, then a DataModel named NameIdInfoModel is generated in the Access Layer DataModels assembly with the same attributes. The type of this DataModel (NameIdInfoModel) can be specified for the GetList<T>() method. The resulting IEnumerable contains a collection of list items of the same type (NameIdInfoModel).

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

IEnumerable<T> GetList<T>(
   string listName
)

The type specifier T should be set to the List model type that is generated in the Access Layer API based on the List Template definition in System Modeler.

Argument

Return Value

If this method succeeds, it returns a collection of list items of a specified type.

Using the IRtConnection Interface for the GetList<T> Method (String)

The following code is an example of using the GetList<T> (String) method:

// Load the PROD ispec that returns the PROD.PRODUCTS list
// Access the list items according to the type definition for the list
       LoadIspec("PROD");
       IEnumerable<NameIdInfoModel> myList =
       ABSConnection.DataHandler.GetList<NameIdInfoModel>("PROD.PRODUCTS");
       NameIdInfoModel item = myList.First<NameIdInfoModel>();
       string id = item.Id;
       string name = item.Name;