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

Binding types that have multiple generic interfaces of the same type #29

Open
ad0ran opened this issue Dec 16, 2016 · 0 comments
Open

Comments

@ad0ran
Copy link

ad0ran commented Dec 16, 2016

So say I have a type that implements interfaces like this:

public class MessageHandler : IHandle<MessageOne>, IHandle<MessageTwo>, IHandle<MessageThree> {
    ...
}

Binding with conventions doesn't seem to work when

IKernel container = new StandardKernel();
container.Bind(x =>
    x.FromAssemblyContaining<MessageHandler>()
        .SelectAllClasses()
        .InheritedFrom(typeof(IHandle<>))
        .BindToSelf())
);

var handlers = container.GetAll(typeof(IHandle<MessageOne>)); // handlers is just empty after trying to get the services

Is the open generic not supported??

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

No branches or pull requests

1 participant