Is it possible to resolve dependencies shown in this small program using only IoC container? How? How to register classes within a container so that each instance A form its own resolution scope?
Is it possible to use single Resolve-call to reproduce the program?
class A
{
}
class B
{
private readonly A a;
public B(A a)
{
this.a = a;
}
}
class C
{
private readonly B b;
public C(B b)
{
this.b = b;
}
public void PrintHello()
{
Console.WriteLine("Hello StackOverflow!");
}
}
class Program
{
static void Main(string[] args)
{
for (var i = 0; i < 10; ++i)
{
var a = new A();
var b = new B(a);
var c = new C(b);
c.PrintHello();
}
}
}