#1 2012-11-05 14:26:40

h.hasenack
Member
From: Nijmegen, Netherlands
Registered: 2012-08-01
Posts: 173
Website

TSQLRestServer.ServiceRegister change request

The current ServiceRegister uses a TInterfacedClass for aImplementationClass

It would clean up my code soooo much if the aImplementationClass would be of type...  TMormotInterfacedClass

interface

type
  TMormotInterfacedObject=class(TInterfacedObject)
  public 
    constructor Create; virtual; 
  end;

implementation

constructor TMormotInterfacedObject.Create; 
begin
  inherited;
end;
     

As it would allow overriding the constructor to initialize my interfaced objects rather than overriding the AfterConstruction method...
Yes, unfortunately it will very likely break some code. (Well, unless a overloaded ServiceRegister method is created. I would not recommend the overloaded method for KISS 's sake - at least mark it as deprecated!)

Whaddyathink?

Hans

Offline

#2 2012-11-05 19:43:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,192
Website

Re: TSQLRestServer.ServiceRegister change request

Good idea.

I've added TInterfacedObjectWithCustomCreate kind of class, making easy to use virtual constructors for TSQLRestServer.ServiceRegister().

So you do not change the ServiceRegister() method, just inherits from TInterfacedObjectWithCustomCreate your custom class, and your overriden constructor will be executed.

See http://synopse.info/fossil/info/3383e49e4e

Offline

#3 2012-11-05 20:12:30

h.hasenack
Member
From: Nijmegen, Netherlands
Registered: 2012-08-01
Posts: 173
Website

Re: TSQLRestServer.ServiceRegister change request

Ah that's cool too... - Thx

Offline

Board footer

Powered by FluxBB