You don't have a cyclic reference of your classes in your example. You just have cyclic assembly references. Introduce some contract assembly that contains the interfaces shared between them and you'll be fine.
Question
I have a wcf project named Service1 that has an Interface IActions
public interface IActions
{
int DoSomething(int param);
}
public class Service1 : IService1
{
private IActions actions;
public Service1(IActions actions)
{
this.actions = actions;
}
public MyAction(int p)
{
return this.actions.DoSomething(p);
}
}
then I have other project that implements IActions interface, so it has a reference to Service1
public class SomeClass : IActions
{
public int DoSomething(int param)
{
return param*param;
}
}
Now I want to implement DI with ninject, and to do so I am doing this bindings
public class NinjectBindings : NinjectModule
{
public override void Load()
{
Bind<IActions>().To<SomeClass>();
Bind<ServiceHost>().To<NinjectServiceHost>();
}
}
this isnt possible because it introduces cyclic references. What am i doing wrong? I know i should have design flaws, but I appreciate that you may show them to me.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow