Spring4D
Spring4D
Is it possible to register and resolve from the container the classes associated with the Owner relationship?
TBaseClass = class
fOwner : TBaseClass;
constructor Create(aOwner : TBaseClass);
end;
constructor TBaseClass.Create(aOwner : TBaseClass);
begin
fOwner := aOwner;
end;
TSomeClass = class(TBaseClass)
TNextClass = class(TBaseClass)
fSomeClass : TSomeClass;
constructor Create(aOwner : TBaseClass; aSomeClass : TSomeClass);
end;
TOtherClass = class(TBaseClass)
fNextClass : TNextClass;
constructor Create(aOwner : TBaseClass; aNextClass : TNextClass);
end;
fOtherClass := Container.Resolve;
fOtherClass is owner for fNextClass is owner for fSomeClass
How to use Spring in this case?
Is it possible to register and resolve from the container the classes associated with the Owner relationship?
TBaseClass = class
fOwner : TBaseClass;
constructor Create(aOwner : TBaseClass);
end;
constructor TBaseClass.Create(aOwner : TBaseClass);
begin
fOwner := aOwner;
end;
TSomeClass = class(TBaseClass)
TNextClass = class(TBaseClass)
fSomeClass : TSomeClass;
constructor Create(aOwner : TBaseClass; aSomeClass : TSomeClass);
end;
TOtherClass = class(TBaseClass)
fNextClass : TNextClass;
constructor Create(aOwner : TBaseClass; aNextClass : TNextClass);
end;
fOtherClass := Container.Resolve
fOtherClass is owner for fNextClass is owner for fSomeClass
How to use Spring in this case?
/interested
ReplyDeleteShow the pure DI code
ReplyDelete/sub
ReplyDelete