hmemcpy / AgentMulder

** THIS PLUGIN IS NO LONGER MAINTAINED. PLEASE FOLLOW ERNICOMMUNITY FOR UPDATES **
https://github.com/ERNICommunity/AgentMulder
MIT License
151 stars 33 forks source link

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

Open ghost opened 11 years ago

ghost commented 11 years ago

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 commented 11 years ago

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!

ghost commented 11 years ago

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

Cheers!