[fpc-devel] Inversion of control for TCustomHTTPModule and descendants

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Mar 6 17:35:23 CET 2012



On Tue, 6 Mar 2012, Sven Barth wrote:

> Hello together!
>
> I'm currently playing around with fcl-web a bit.
>
> As I'd like to utilize inversion of control (e.g. passing things like 
> database connections through the constructor [as one possible implementation 
> of this pattern]) for my modules I'd like to ask whether it would be an idea

whooohoo - expensive terminology detected !!
"Inversion of Control" 
:-)

> for a feature request (maybe even with patch) to add an "OnCreateModule" 
> event to TWebHandler which is called inside TWebHandler.HandleRequest before 
> the module is created using CreateNew or Create?

Well, it can only be after create. 
You need the instance first, and it is constructed with Create(New).

If you need to do something before that, there already is the OnGetModule handler.

But yes, a centralized initialization handler for webmodules is OK. 
Something like 'OnInitModule' or so ?

Michael.



More information about the fpc-devel mailing list