1
如何在datasnap服務器中處理對象引用?Datasnap和TObject引用
我有返回TUSER對象
TServerMethods.CurrentUser(const AId: Integer): TUser
begin
Result := GlobalCurrentUser; // <- Don't want to free this object
Result.AddReference;
end;
TUSER在子類TReferencedObject
TReferencedObject = class(TObject)
private
FReferenceCnt: integer;
public
procedure AddReference; virtual;
procedure RemoveReference; virtual; // Frees object if reference count goes to 0
property ReferenceCnt: integer Read FReferenceCnt Write FReferenceCnt;
end;
的DataSnap服務器方法目前的DataSnap服務器釋放TUSER對象,但我想打電話給RemoveReference爲TReferencedObject後裔。