I am following this article to create a pluggable MVC application. Once ninject
has been installed, it says to add this:
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
kernel.Bind(a => a.FromAssembliesInPath(path).SelectAllClasses().BindDefaultInterface());
to the RegisterServices
method in the NinjectWebCommon.cs
file, however, when I do this, I get the following error:
Cannot convert lambda expression to type 'System.Type[]' because it is not a delegate type.
This is fair enough, I understand the error but I'm not sure how to get around it. Has something changed in ninject to cause this error? I would appreciate some advice on how to proceed.
The Bind
method with the signature Bind(this IBindingRoot kernel, Action<IFromSyntax> configure)
- which was used in the article - is declared as an extension method in the Ninject.Extensions.Conventions
namespace's ExtensionsForIKernel
class inside the ninject.extensions.convention plugin.
So you are missing the right using
statement.
Add this line to the NinjectWebCommon.cs
file to make your code compile:
using Ninject.Extensions.Conventions;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With