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
listName – System.String
This argument provides the name of the list to be retrieved, which is set up in the host application logic by using the Glb.ClientManager’s SendDynamic() or SendStatic() methods. If you supply a list name parameter in these methods, the specified name must be used in the GetList<T>() method (for example, PRODUCTLIST). If a name is not provided in the SendDynamic() or SendStatic() call, the default format for this argument is “ClassName”.”Attribute Name”, where Attribute Name is the name of the List instance in System Modeler (for example, PROD.Products).
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;