UnityConfiguration icon indicating copy to clipboard operation
UnityConfiguration copied to clipboard

Registrations overwrite existing registrations

Open roryprimrose opened this issue 12 years ago • 2 comments

I'm using a combination of registration via configuration and convention. I've added in the FirstInterfaceConvention but it is wiping out the registrations that already exist in the container.

I would prefer that it only add registrations where there isn't already an existing registration (matching on name or lack thereof).

roryprimrose avatar Apr 19 '13 05:04 roryprimrose

I think the bug in RegistrationExpression.cs at line 55. The logic should be:

else if (container.IsRegistered(typeFrom, name) == false)

roryprimrose avatar Apr 19 '13 05:04 roryprimrose

I ran into this issue as well, but encountered it when using the FactoryRegistrationExpression. The same logic to check if the type is already registered also applies there.

gmarz avatar Apr 26 '13 15:04 gmarz