How I can use multiple parameters in Ninject syntax like following?
Bind<IMyRepository>()
.To<SqlMyRepository>()
.WithConstructorArgument("connectionString",
ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString
);
What if more than one parameter need to be passed?
You can chain the calls to WithConstructorArgument
:
Bind<IMyRepository>()
.To<SqlMyRepository>()
.WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString)
.WithConstructorArgument("timeout", 10000);