Hi, I have a problem.... Lest say I have a class like this one:
public class A: InterfaceA
{
private FileInfo _fileInfo = null;
public A(FileInfo fileInfo)
{
this._fileInfo = fileInfo;
}
...
}
and another one:
public class B: InterfaceB
{
private A _classA = null;
public B(A classA)
{
this._classA = classA;
}
public void Do()
{
FileInfo fi = new FileInfo(...);
_classA.DoSomething();
}
}
Now, I have setup StructureMap registers like this:
For<InterfaceA>().Use<A>();
For<InterfaceB>().Use<B>();
and when I execute B.Do() structuremap will throw an error because there is no registry entry for FileInfo parameter. The parameter of class A (FileInfo) is constructed in class B; I know that I can do: ObjectFactor.GetInstance() and pass parameters, but I want Dependency injection not service provider. And I want that when I do ObjectFactory.GetInstance(), to construct entire object graph.
How to do this?