Make TDBConnectionPool.GetConnection virtual

Could GetConnection method in TDBConnectionPool (unit XData.Aurelius.ConnectionPool) be made virtual in future versions?

I have my own ConnectionPool inherited from TDBConnectionPool that needs overriding GetConnection, to do so I have to keep a custom (modified) install of XData.


You can simply redeclare GetConnection in descendant class and reimplement the interface:

TMyConnectionPool = class(TDBConnectionPool, IDBConnectionPool)
  function GetConnection: IDBConnection;

This will simply call GetConnection from your class, not from the base class.

Hi Wagner, thanks for your feedback.

I tryed that before and did not work as intended (TDbConnectionPool gets called instead of TMyConnectionPool).

I'll check again.

You have to make sure that TMyConnectionPool "reimplements" IDBConnection interface. This will not work:

TMyConnectionPool = class(TDBConnectionPool)

You have to explicitly "implement" the interface (even though it's already implemented in ancestor):

TMyConnectionPool = class(TDBConnectionPool, IDBConnectionPool)

Got it. Thanks !!

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.