The following example shows how to program a manager class:
The following method is declared in the base class PARole:
public static T GetServiceInstance<T>(ACComponent requester, string acIdentifier, CreationBehaviour creationBehaviour = CreationBehaviour.Default) where T : IACComponent
This static helper method returns the instance of any manager class. It searches for the instance in the following order:
- Below the requesting component itself (child). If it wasn't found there, then it will
- searched below "\ Root \ LocalServiceObjects" . If it wasn't found there, then it will
- searched in the application project "\ Services" (network instance)
In the example code above, two methods (A) and (B) have been declared that use the GetServiceInstance <T> method. In your manager class that you want to program, however, you have to decide whether it should be available locally (A) or as a network service (B). Both as in the example above are not possible.
The other two methods (C) and ( D ) use GetServiceInstance () and create a smart pointer ACRef <T> .
The "SumLines ()" (E) method is intended for local use. Please note that all necessary data must be transferred as parameters because manager classes must be stateless.
The "SumLinesByID" (F) method is intended for use in a network.
Now let's look at how this "manager class" is used:
If you want to use your manager class locally , then you should program it as in the example under points (A) and (C) . To use it as a network-compatible instance, program it as described in points (B) and (D) .
Don't forget to disconnect the smart pointer in the deinitialization phase (E) .