Hey,
is it possible to inherit from TRORemoteDataModule to implement some basic logging functions?
Doing this like = class(TRORemoteDataModule )
won’t work. Any experiences?
Thanks!
Hey,
is it possible to inherit from TRORemoteDataModule to implement some basic logging functions?
Doing this like = class(TRORemoteDataModule )
won’t work. Any experiences?
Thanks!
Hi,
yes, you can.
check our samples - almost each sample contains line, like
TPhotoServerService = class(TRORemoteDataModule, IPhotoServerService)
Nah I’m looking for a solution to do something like this
TPhotoServerService = class(TBaseRemoteDataModule, IPhotoServerService)
So I don’t need to implement the same logging methods for each microservice.
I want to extend your TRORemoteDataModule for future use.
Why you can’t use class helper?
also you can create own descendant from TRORemoteDataModule , add some methods into it and inherit your services from this logging service
class helper are dirty
own descendant from TRORemoteDataModule
Would be great but doesn’t work. The DataModule will be converted to a formular. Therefore the question.
how then our DataAbstract Service works w/o problems?
base service:
TDataAbstractService = class(TRORemoteDataModule, ...
how it was used:
TDataService = class(TDataAbstractService, IDataService)
try to remove {$R *.dfm}
from your _Impl with logging service
Test.zip (4.9 MB)
Doesn’t work :-/
everything works.
check testcase: Testcase.zip (110.3 KB)
Magic
I didn’t implement a .dfm that was the mistake. Thaks for your help!
Is there any possibility to inherit from LoggingService without creating a LogginService.dfm?
if I remove LogService_Impl.dfm
and update LogService_Impl.pas as
unit LogService_Impl;
// ----------------------------------------------------------------------
// This file was automatically generated by Remoting SDK from a
// RODL file downloaded from a server or associated with this project.
//
// This is where you are supposed to code the implementation of your objects.
// ----------------------------------------------------------------------
{$I RemObjects.inc}
interface
uses
{$IFDEF DELPHIXE2UP}System.SysUtils{$ELSE}SysUtils{$ENDIF},
{$IFDEF DELPHIXE2UP}System.Classes{$ELSE}Classes{$ENDIF},
{$IFDEF DELPHIXE2UP}System.TypInfo{$ELSE}TypInfo{$ENDIF},
uROEncoding,
uROXMLIntf,
uROClientIntf,
uROClasses,
uROTypes,
uROServer,
uROServerIntf,
uROSessions,
uRORemoteDataModule,
TestLibrary_Intf;
const __ServiceName = 'LogService';
type
{ Forward declarations }
TLogService = class;
TLogService = class(TRORemoteDataModule, ILogService)
public
procedure Log(const NewParam: UnicodeString); virtual;
end;
implementation
{$IFDEF DELPHIXE2UP}
{%CLASSGROUP 'System.Classes.TPersistent'}
{$ENDIF}
uses
fServerForm,
TestLibrary_Invk;
var fClassFactory_LogService: IROClassFactory;
procedure Create_LogService(out anInstance: IInterface);
begin
anInstance := TLogService.Create(nil);
end;
procedure TLogService.Log(const NewParam: UnicodeString);
begin
ServerForm.Log(NewParam);
end;
initialization
fClassFactory_LogService := TROClassFactory.Create(__ServiceName, {$IFDEF FPC}@{$ENDIF}Create_LogService, TLogService_Invoker);
// RegisterForZeroConf(fClassFactory_LogService, '_LogService_rosdk._tcp.');
finalization
UnRegisterClassFactory(fClassFactory_LogService);
fClassFactory_LogService := nil;
end.
everything works correctly
There will be a conflict with
inherited TestService: TTestService
end
if you are using
object TestService: TTestService
end
form will be shown incorrectly (as a descendant of TForm)
but with
inherited TestService: TTestService
end
everything is ok
It will be okay at runtime but at design time an error will occur (what isn’t that dramatic) because
TLogService.dfm isn’t found.
why you want to remove LogginService.dfm?
Because then I need to reference LogginService.dfm and LogginService.pas in each microservice (and I have a lot of them…). A global path isn’t enough.