Support for Ninject Conventions (Assembly based auto-registration) #54

Open
willhughes opened this Issue May 29, 2013 · 2 comments

2 participants

@willhughes

It would be awesome if we could get support for Ninject Conventions registration-by-convention.

We register all our classes across all our assemblies like so:

IKernel kernel = new StandardKernel(new NinjectSettings { LoadExtensions = true});

kernel.Bind(t => t.FromAssembliesMatching("Application.Namespace.*")
          .SelectAllClasses()
          .BindAllInterfaces());

This loads all Application.Namespace.*.dll assemblies and registers all interfaces on all classes.

We then Rebind any interfaces requiring special treatment.

kernel.Rebind<ICacheManager>().To<CacheManager>().InSingletonScope();

Thanks

@hmemcpy hmemcpy was assigned May 29, 2013
@hmemcpy
Owner

Thanks for reporting this!

I am not extremely familiar with Ninject's conventions API, so I would love it if you could contribute Test Case Data, and I'll take care of the rest!

@willhughes

Sure, I'll take a look at getting that going.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment