Passing constructor parameter throught multiple objects while resolving in AutoFac

34 Views Asked by At

i have difficulties getting my registration in AutoFac done.

Let`s say i have the following classes

class Foo : IFoo
{
public Foo(string test, IBar bar) {}
}

class Bar : IBar 
{
public Bar(bool someFlag) {}
}

The issue I'm having now is that i don't know how to set this boolean 'someFlag' while resolving. I am only able to create these objects and fill in the flag while resolving, not while registering the classes. Note: This is just an easy example to show the problem. In my case there are half a dozen classes in between Foo and Bar.

Can anyone please help me?

I know how to fill a parameter directly like the string 'test'. But I don`t understand how i pass the boolean through Foo to Bar.

0

There are 0 best solutions below