Innovator clients send queries to the server; the server then processes the queries and sends a reply back to the client. Innovator is a multi-user system; this means that various clients can be accessing the same server at the same time. Queries made by these clients are then sequentially dealt with by the server. If the server carries out a time-consuming action to deal with one of these queries then the other clients with queries have to wait for this one to be completed before their query can be dealt with. If server access is inefficient, this can slow everything down.
Plug-ins send queries like this using the server API. This is done by calling methods for model elements or querying their properties. The API then generates a "telegram" which contains the necessary data which will be sent to the server. It takes a long time to send a telegram to the server as communication needs to take place via the network.
Even querying a simple element property such as the name using the DisplayName property causes a telegram to be sent to the server.
If possible, avoid sending large numbers of telegrams.This may be a problem when testing executability of commands in CanExeCmd methods. These tests are accessed a lot which means that it doesn’t make sense to access the server for these methods. It is a better idea to enable the commands and then check the condition which server access requires once the command is executed. Output an error message if the condition is not fulfilled and then abort the command execution.
It is often necessary to determine various properties of elements from one set (e.g. name, icon, namespace). The worst way to do this is to use a loop of all elements in the set which then queries the appropriate properties for each element respectively. The amount of server telegrams produced is based on the number of elements and properties.
It is much quicker to determine all information using just one telegram and the ServerUtilities.GetElementInfos (Util.dll) method. The name and access of the elements are determined in the following example.
The method only works if information is defined for all elements in the set. If this is not the case, the method will throw an exception.
The method only provides values from the string, bool, long or Point types.If the result is an element, the GetElementViews method should be used in the same way.
© 1986-2014 MID GmbH Nuremberg Germany. DIN EN 9001 certified. All rights reserved.