IConnection.LoadAsync Method

The LoadAsync method is an asynchronous call that loads a specified ispec or class in the runtime system for a session. The calling process is not blocked during the execution of the method. A specified callback method receives a new TransmissionObject when the call completes.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

Task<TransmissionObject> LoadAsync(
	 string name,
   bool withSwitch = true
)

Arguments

Return Value

If this method succeeds, a TransmissionObject can be retrieved containing the specified DataModel that was loaded.

Using the IConnection Interface for the LoadAsync Method

The following code shows an example of using the LoadAsync() method to load a specified ispec into the current application context:

// Load a specified ispec into the current context using the LoadAsync call on the Connection object
        public async void LoadIspecAsync(string ispecName)
        {
       // Call LoadAsync with the ispecName parameter.

       // The LoadIspecComplete() method is executed when the 
       // Load request to the host system is complete
            TransmissionObject trObj = await ABSConnection.LoadAsync(ispecName,LoadIspecComplete);

            if (trObj != null && (trObj.State == TransmissionReturnCode.Ok || 
trObj.State == TransmissionReturnCode.OkWithSwitch))
            {
                CurrentIspecName = trObj.ObjectClassName;
                CurrentTO = trObj;
            }

        }