Unnamed registration not returned by ResolveAll when using AsDefault on named registration

Issue #22 resolved
Stefan Glienke repo owner created an issue

AsDefault does not mark an existing unnamed default registration as non default.

To reproduce:

container.RegisterType<IFoo, TFoo3>;
container.RegisterType<IFoo, TFoo2>;
container.RegisterType<IFoo, TFoo1>('foo').AsDefault;
container.Build;

for foo in container.ResolveAll<IFoo> do
  Writeln((foo as TObject).ClassName);

Expected:

TFoo3
TFoo2
TFoo1

Actual:

TFoo3
TFoo1

Comments (5)

  1. Stefan Glienke reporter

    This issue has been handled by the recent change to TComponentRegistry.FindAll(serviceType: PTypeInfo) which is used by ResolveAll. It now only returns named registrations.

  2. Log in to comment