I am using Ninject in an MVC3 application and am trying to switch over to conventions based binding with ninject.extensions.conventions.
Now let's say I have a class that needs access to application settings such as:
public class Foo : IFoo
{
public Foo(string connectionString)
{ ... }
}
I think I understand how to do normal binding with Ninject like this:
Bind<IFoo>()
.To<Foo>()
.WithConstructorArgument(
"connectionString",
ConfigurationManager.ConnectionStrings["Default"].ConnectionString);
But how do I do this using conventions instead?
Extra information if needed:
I'm using the nuget Ninject.MVC3 package and in App_Start/NinjectWebCommon.cs's RegisterServices this is all I currently have:
kernel.Bind(x => x
.FromAssembliesMatching("*")
.SelectAllClasses()
.BindDefaultInterface());