Application Programming for .NET: The Basics

The essential lesson to know about calling a CA Aion BRE server from a .NET client is that the client must obtain a session object of type AionSession in order to bind the CA Aion BRE objects. Every object has to be created with a reference to an AionSession object. The AionSession object is the means by which CA Aion BRE can guarantee thread safety in a multi-threaded environment such as .NET provides.

AionSession is defined in the Net2Aion project through the parent AionObject class. Three constructors will be generated for each class that is exported from the CA Aion BRE application and exposed in the Managed C++ dll:

ExpClassA(Net2Aion::AionSession *session);
ExpClassA (String __gc *objectname, Net2Aion::AionSession *session);
ExpClassA (__int64 AionAppExp, Net2Aion::AionSession *session);

These constructors help in creating the managed object in the specified AionSession. These constructors in turn calls the protected member CreateAionObject() in the Managed C++ dll, which creates the private Aion BRE object (this object is represented by the m_pC pointer in the managed_c0.cpp code, see Structure of the Managed C++ Interface Layer.

Once an AionSession object is obtained, this object is used in the constructor of the proxy class (AionWorld).

myAionApplication. anAionWorldObject myObject = new
myAionApplication. anAionWorldObject(mySession);

In the preceding code, anAionWorldObject is an exported class from the Aion BRE application, which is replicated as a proxy class in myAionApplication.

Once an object is created in the .NET client, the exposed methods of the CA Aion BRE class can be called through that instance.

Example:

anAionWorlObject.setMessage("Hello Aion world");

where setMessage( ) is a public method of anAionWorldObject.

Note: References to non-exported classes in the .NET code causes compile errors.

More Information:

Thread Management

Structure of the Managed C++ Interface Layer


Copyright © 2009 CA. All rights reserved. Email CA about this topic