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

Add Bind<TInterface> syntax to bind a specific interface #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add Bind<TInterface> syntax to bind a specific interface #18

wants to merge 4 commits into from

Conversation

BrunoJuchli
Copy link

We would like to have IBindSyntax.Bind<> syntax to bind a specific interface, like:

IBindingRoot.Bind(x => x
         .FromCurrentAssembly()
         .SelectAllClasses()
         .InheritingFrom<IFoo>
         .Bind<IFoo>);

Hint:

  • The pull request also contains IBindSyntax.Bind(params Type[] serviceTypes). We don't need that but i felt i wouldn't make it more complex. If you think it only blows up the syntax interface without generating adequate benefit feel free to remove it (or tell me to remove it ;-) ).
    • This required adapting the kernel mock in order to be able to test .Bind(typeof(IFoo), typeof(IBar)).To(typeof(FooBar)) style bindings.
  • Also i did not base it on IBindSyntax.BindSelection(...) since i felt it makes it more complicated then necessary. But if you insist on it i will adapt the pull requeset ;-).

IBindSyntax.Bind<T>();
IBindSyntax.Bind(params Type[] types);
@danbopes
Copy link

Damn, since 2014 :(

This would have been a rather nice thing to have implemented.

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