Thick client support in managed applications (client/server)
Scope: managed applications, ordinary applications.
1. In managed application mode, due to certain limitations of the thin client, you may need to provide thick client support.
2. Configurations designed for managed application mode assume that the following modules' code is compiled and executed solely on the server in a client-server architecture:
- Manager module
- Object module
- Session module
These modules may access common modules available only on the server.
However, in a thick client running in managed application mode, these modules may begin to compile and run on the client side in specific situations, for example:
- When an object, such as a catalog or document, is explicitly created and called in client code.
- When the 1C:Enterprise platform implicitly accesses manager modules and a session module to call their event handlers on the client.
Compiling and running such modules on the client side may cause errors. In managed application mode, you can run a configuration check for the thick client to find errors in these modules.
To prevent unintended compilation and execution of these modules on the client, and to avoid unnecessary configuration check mode messages, follow these steps:
- Exclude the code of object modules from the client context. To do so, put the code in a preprocessor command and raise an exception to prevent unauthorized attempts to use the object on the client:
#If Server Or ThickClientOrdinaryApplication Or ExternalConnection Then
…
#Else
Raise NStr("en = 'Invalid object call on the client.'");
#EndIf
- Exclude the session module code from the client context by putting it in a preprocessor command. The session parameters are required for server-side code rather than client-side code:
#If Server Or ThickClientOrdinaryApplication Or ExternalConnection Then
…
#EndIf
- Exclude the code of manager modules of all metadata object types from the client context by putting it in a preprocessor command:
#If Server Or ThickClientOrdinaryApplication Or ExternalConnection Then
…
#EndIf
In the latter case, the following limitation also applies: if object presentation is generated by the PresentationGetProcessing and PresentationFieldsGetProcessing event handlers of the manager module, in the thick client (managed application, client/server mode), it will be generated by default without calling these handlers. The ChoiceDataGetProcessing and FormGetProcessing event handlers are always called only on the server, so this limitation does not apply to them.
Best practices 3. To remove the above limitation, the following server code fragments need to be supported on the client side:
Move the code of these event handlers outside the preprocessor commands specified in item 2 and place subscription handlers in client/server modules. When calling server procedures or functions from client code, ensure that the procedures are placed in server common modules with the Server call checkbox selected. Parameters and return values of such procedures and functions must not contain values of mutable types—for example, CatalogObject and DocumentObject. Do not forcefully select the Server call checkbox for all common modules with the Server flag. For more details, see Common modules: Server call property. For example, the PresentationGetProcessing event handler calls a common module unavailable on the client side: Procedure PresentationGetProcessing(Data, Presentation, StandardProcessing) Instead, switch to the server without passing mutable-type values to the client: Procedure PresentationGetProcessing(Data, Presentation, StandardProcessing) EndProcedure |