Hi Hans
Damn good, if not perfect! Good on you mate, and you've realized that the interface is only needed in the 'TrxManager' for 'Committing'.
Actually you can get away with just using the 'built-in' 'ItrxExec' interface, as it provides the /execute-through-owner/ mechanism, namely: 'Execute(TrxMgr)'.
You don't need to create new interfaces in 'model.intf', for each new little 'wrinkle' in your app, just create a transaction that implements 'ItrxExec', thats it. 'Cause in the rest of its lifetime, you'll use the class-part of it... I think it saves us a /hellofalot/ of typing
I'm assuming that 'ItrxCreNewFile' descends from 'ItrxExec'...
Then you can:
// try the self committing transaction
prCreDatabaseFile_SelfExecuteTest: if fTrx.GetInterface(SGUIDItrxExec,lte) then begin // <<= use exec sguid
if lte.Execute(Self) then
fOwner.Provider.NotifySubscribers(prStatus,nil,Str2Pch('Self commit is a success.'));
end;
Use the 'built-in' "SGUIDItrxExec" in TrxManager, i.e.: only 1 local variable in 'CommitTransaction' -> lte; The fTrx transaction *knows* which type it is, so it will call the right 'Execute' method.
For Convenience, I just reference the 'presenter.trax', in the view I'm using it in, it's a 'minion' of the presenter, so that's perfectly legal and saves me a couple of aliases
It's all about scope and what the different /components/ need to do their job...
In short, you did the correct and longer version =^ The above explanation is just to show you the "Shorthand" or easier way... (which corners you can cut)
Warm and sunny regards Benny