You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This question is related to this question on stackoverflow.
Consider we have a fully functional, verified set of registrations that include conditionals. Obviously, there is no overlap between the conditional registrations because otherwise the container would have thrown an exception. It feels very odd that the container immediately throws an exception with these exact same registrations and the option AllowOverridingRegistrations set to true from the get-go. There is, of course, a very easy workaround for this scenario: set the option after making these registrations.
Now consider the exact same scenario as above. The option has been set at the end (so no exceptions) and we can start overriding some registrations for integration test purposes. All is well, except if you need an additional conditional registration.
Even if it is a totally different abstraction, the registration will fail;
Even if there have been no overrides yet, the registration will fail.
Would it be possible to allow making conditional registrations if the option AllowOverridingRegistrations is true under the following circumstances: No actual overrides have been made yet. That would at least overcome issue (2) above.
Would be awesome if issue (1) can be remedied as well.
The text was updated successfully, but these errors were encountered:
dotnetjunkie
changed the title
Allow conditional registrations to be made even if AllowOverridingRegistrations is set to true
Allow conditional registrations to be made even if AllowOverridingRegistrations is set to true
Oct 15, 2020
This question is related to this question on stackoverflow.
Consider we have a fully functional, verified set of registrations that include conditionals. Obviously, there is no overlap between the conditional registrations because otherwise the container would have thrown an exception. It feels very odd that the container immediately throws an exception with these exact same registrations and the option
AllowOverridingRegistrations
set totrue
from the get-go. There is, of course, a very easy workaround for this scenario: set the option after making these registrations.Now consider the exact same scenario as above. The option has been set at the end (so no exceptions) and we can start overriding some registrations for integration test purposes. All is well, except if you need an additional conditional registration.
Would it be possible to allow making conditional registrations if the option
AllowOverridingRegistrations
istrue
under the following circumstances: No actual overrides have been made yet. That would at least overcome issue (2) above.Would be awesome if issue (1) can be remedied as well.
The text was updated successfully, but these errors were encountered: