I have the following classes:
public interface IServiceA
{
string MethodA1();
}
public interface IServiceB
{
string MethodB1();
}
public class ServiceA : IServiceA
{
public IServiceB serviceB;
public string MethodA1()
{
return "MethodA1() " +serviceB.MethodB1();
}
}
public class ServiceB : IServiceB
{
public string MethodB1()
{
return "MethodB1() ";
}
}
I use Unity for IoC, my registration looks like this:
container.RegisterType<IServiceA, ServiceA>();
container.RegisterType<IServiceB, ServiceB>();
When I resolve a ServiceA
instance, serviceB
will be null
.
How can I resolve this?