Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement UnregisterMultiple #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stefanmoser
Copy link

This is an implementation of UnregisterMultiple. The main reason this is needed is that RegisterMultiple uses a convention to register each type as a named type with the full name of the type. Therefore if you had previous registered a type using...

container.RegisterMultiple<TInterface>(new [] { type });

...you would then have to unregister the type using...

container.Unregister<TInterface>(type.FullName);

This is a little unintuitive. This PR allows you to unregister the type using...

container.UnregisterMultiple<TInterface>(new [] { type });

...which is the same syntax that the type was originally registered.

// if (!registrationType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
//#else
if (!registrationType.IsAssignableFrom(type))
//#endif
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unsure about including the commented out #if NETFX_CORE. This code was copied from the implementation of public MultiRegisterOptions RegisterMultiple(Type registrationType, IEnumerable<Type> implementationTypes) so I left it in for consistency.

@niemyjski
Copy link
Collaborator

Could you please resolve the merge conflicts and well get this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants