Salesforce

.NET Variables vs .NET Objects (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

.NET Variables vs .NET Objects (Magic xpa 4.x)

.NET variables in Magic xpa represent .NET objects. The .NET variable keeps only a reference to the .NET object; therefore, any properties of the .NET object are not stored in the Magic xpa .NET variable.

This means for example that:

  • A .NET variable cannot be sent as an argument from a Rich Client task to a Batch task.

  • A .NET variable defined in a Rich Client task cannot be used in a Batch task.

  • A .NET variable defined in the Main Program cannot be sent as an argument to a Rich Client task.

  • .NET variables used in the Main Program will be "duplicated" for the client and server (different instances of the .NET object). This means that the .NET variable defined in the Main Program can be used by a Rich Client task and by a Batch task. However, any update of the variable in the Rich Client task will not be available in the Batch task and vice versa.

  • The Magic xpa recompute mechanism works when a change is made to the .NET variable (the .NET object reference) and not a change to one of the .NET variable properties. For example, changing the text value of .NET variable A will not cause recompute when the expression A.Text is used. If you need the recompute mechanism when a property is changed, you should either:

  • Use the .NET binding capabilities so that the recompute will be done on the Magic xpa variable. Refer to How Do I Bind Data to a .NET Control?.

  • Define a .NET event handler on the property that you want to do the recompute on (such as a TextChanged handler for the Text property) and update a Magic xpa variable in this handler. The Magic xpa variable will then be used as the recomputed expression.

  • A .NET variable should not be stored as a shared value using the SharedValSet function. When using the SharedValSet function for a .NET variable, only the variable reference is stored as a shared value. This means that if the .NET object was created in a task that is now closed, the reference stored in the shared value will refer to a non-existing object.

Reference
Attachment 
Attachment