RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TRemotable.DataContext Property

Specifies the object that controls the lifetime of a TRemotable instance.

Pascal
property DataContext: TDataContext;
C++
__property TDataContext DataContext;

By default, when a Web Service application creates an instance of a remotable object, that object exists only for the time it takes to marshal the information it represents or to unmarshal that information into the TRemotable instance and then make a method call that uses the instance. The object specified by DataContext handles the freeing of the TRemotable instance. 

There are times when a server may not want the TRemotable instance to be so transient. For example, if the object contains state information, it may be more efficient to have a single instance that is used for every message call. If you change DataContext, the TRemotable instance is removed from the data context, and is not freed when the data context goes away at the end of the method call.

Note: If DataContext is nil (Delphi) or NULL (C++), the application is responsible for freeing the TRemotable instance. For example, TRemotable objects created on client applications are created with a nil (Delphi) or NULL (C++) value for DataContext and must be freed by the client application.
 

 

Using Remotable Objects

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!