I have an MVC5, WebApi application that works fine if I don't include the Ninject.Extension.Factory 3.2.0.0 3/21/2014 build. Once I add that package the application has the following exception:
Error activating EntitleActionFilter using self-binding of EntitleActionFilter
Several constructors have the same priority. Please specify the constructor using ToConstructor syntax or add an Inject attribute.
Constructors:
EntitleActionFilter(List{NavigationItem} navigationItemsFunc{IEnumerable{string}} permissionFunc)
EntitleActionFilter(List{NavigationItem} navigationItemsFunc{IEnumerable{int}} permissionFuncInt)
I'm using the following Ninject packages (all Friday, 3/21/2014 builds):
- Ninject 3.2.0.0
- Ninject.MVC5 3.2.0.0
- Ninject.Web.Common 3.2.0.0
- Ninject.Web.Common.WebHost 3.2.0.0
Those two constructors are unique. The bindings look like:
Func<IEnumerable<int>> permissionFunc = () => Kernel.Get<INavigationPermissionsProvider>().GetPermissionsInt();
this.BindFilter<EntitleActionFilter>(FilterScope.Controller, 0)
.WithConstructorArgument("navigationItems",
context => context.Get<NavigationHelper>().GetNavigation().NavigationItems)
.WithConstructorArgument("permissionFuncInt", permissionFunc);
I do use Ninject factories a lot and need this package. If I remove the Ninject.Extensions.Factory 3.2 package, everything works. This same code worked with the previous 3.0 version of Ninject and the factory extension.