mjn*_*mjn 4 delphi attributes dependency-injection inversion-of-control
是否有可能,如果是,Delphi(Win32)中的依赖注入容器的实现支持"自定义属性" - 基于注入,看起来像
TDiExample = class(TObject)
private
[Dependency]
AOther: ISomeInterface
...
end;
Run Code Online (Sandbox Code Playgroud)
(请参阅.Net对应的依赖注入和.NET属性,以及/sf/ask/56881961/ for Delphi Win32 DI框架)
到目前为止,我已经看到了使用直接调用依赖注入容器的示例,例如:
var
AOther: ISomeInterface
...
AOther := DiContainer.Get(ISomeInterface) as ISomeInterface;
Run Code Online (Sandbox Code Playgroud)