-
Notifications
You must be signed in to change notification settings - Fork 525
Closed
Labels
Description
When an interface is bound to a class (named) and that class needs the same interface in it's constructor with a different name ninject throws complaining about a cyclic dependency.
This is different from the previous version of ninject which correcly resolved this,
example:
interface IScreen
{
}
class View1 : IScreen
{
private readonly IScreen _childView;
public View1([Named("ChildView")] IScreen childView)
{
_childView = childView;
}
}
class ChildView : IScreen
{
public ChildView()
{
}
}
class Program
{
static void Main(string[] args)
{
var kernel = new StandardKernel();
kernel.Bind<IScreen>().To<View1>().Named("MainView");
kernel.Bind<IScreen>().To<ChildView>().Named("ChildView");
var instance = kernel.Get<IScreen>("MainView"); // <-- This throws with a cyclic dependency exception
}
}
Reactions are currently unavailable