I would like to be able to code in Delphi this way, just annotating the field:
type
TMyClass = class
private
[Inject]
Factory: ISomeFactory;
...
end;
or by assigning a setter
type
TMyClass = class
private
FFactory: ISomeFactory;
[Inject]
procedure SetFactory(const AFactory: ISomeFactory);
...
public
property Factory: ISomeFactory read FFactory write SetFactory;
end;
Background: I move the old code to a service-oriented architecture and find that a link to the service level always leads to constructions like
DataModule1.ServiceLayerInstance1.SubSystemN.InvokeSomething(Params, ...);
which can be much shorter than
type
Form1 = class(TForm1)
private
[Inject]
SubsystemN: ISubsystemN;
...
end;
...
SubsystemN.InvokeSomething(Params, ...);
source
share