//
// Erzeugt vom DataSnap-Proxy-Generator.
// 18.06.2012 14:00:32
//
unit DataSnapUnits;
interface
uses Data.DBXCommon, Data.DBXClient, Data.DBXDataSnap, Data.DBXJSON, Datasnap.DSProxy, System.Classes, System.SysUtils, Data.DB, Data.SqlExpr, Data.DBXDBReaders, TransportUnits, Data.DBXJSONReflect;
type
TMyClassClient =
class(TDSAdminClient)
private
FGetTransportCommand: TDBXCommand;
FSetTransportCommand: TDBXCommand;
public
constructor Create(ADBXConnection: TDBXConnection);
overload;
constructor Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean);
overload;
destructor Destroy;
override;
function GetTransport: TSendeMich;
procedure SetTransport(_obj: TSendeMich);
end;
implementation
function TMyClassClient.GetTransport: TSendeMich;
begin
if FGetTransportCommand =
nil then
begin
FGetTransportCommand := FDBXConnection.CreateCommand;
FGetTransportCommand.CommandType := TDBXCommandTypes.DSServerMethod;
FGetTransportCommand.Text := '
TMyClass.GetTransport';
FGetTransportCommand.Prepare;
end;
FGetTransportCommand.ExecuteUpdate;
if not FGetTransportCommand.Parameters[0].Value.IsNull
then
begin
FUnMarshal := TDBXClientCommand(FGetTransportCommand.Parameters[0].ConnectionHandler).GetJSONUnMarshaler;
try
Result := TSendeMich(FUnMarshal.UnMarshal(FGetTransportCommand.Parameters[0].Value.GetJSONValue(True)));
if FInstanceOwner
then
FGetTransportCommand.FreeOnExecute(Result);
finally
FreeAndNil(FUnMarshal)
end
end
else
Result :=
nil;
end;
procedure TMyClassClient.SetTransport(_obj: TSendeMich);
begin
if FSetTransportCommand =
nil then
begin
FSetTransportCommand := FDBXConnection.CreateCommand;
FSetTransportCommand.CommandType := TDBXCommandTypes.DSServerMethod;
FSetTransportCommand.Text := '
TMyClass.SetTransport';
FSetTransportCommand.Prepare;
end;
if not Assigned(_obj)
then
FSetTransportCommand.Parameters[0].Value.SetNull
else
begin
FMarshal := TDBXClientCommand(FSetTransportCommand.Parameters[0].ConnectionHandler).GetJSONMarshaler;
try
FSetTransportCommand.Parameters[0].Value.SetJSONValue(FMarshal.Marshal(_obj), True);
if FInstanceOwner
then
_obj.Free
finally
FreeAndNil(FMarshal)
end
end;
FSetTransportCommand.ExecuteUpdate;
end;
constructor TMyClassClient.Create(ADBXConnection: TDBXConnection);
begin
inherited Create(ADBXConnection);
end;
constructor TMyClassClient.Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean);
begin
inherited Create(ADBXConnection, AInstanceOwner);
end;
destructor TMyClassClient.Destroy;
begin
FreeAndNil(FGetTransportCommand);
FreeAndNil(FSetTransportCommand);
inherited;
end;
end.