Is it possible to register the same class / interface multiple times in
Spring4D?
I'm currently playing around with the Spring4D framework and think it's
pretty cool. I'm trying to achieve the following
GlobalContainer.RegisterComponent<TPerson>.Implements<IPerson>('Normal');
GlobalContainer.RegisterComponent<TPerson>.Implements<IPerson>('TestData').DelegateTo(
function: TPerson
begin
result := TPerson.Create;
result.SetFirstName('Bob');
result.SetSurname('Smith');
end
);
With TPerson/IPerson having the obvious definitions. But regardless if I try
Person := ServiceLocator.GetService<IPerson>('Normal');
or
Person := ServiceLocator.GetService<IPerson>('TestData');
I always get Bob, is this possible or am I doing something wrong?
No comments:
Post a Comment