tags:

views:

16

answers:

1

If I have a class like so:

public SomeClass : ISomeClass
{
    public SomeClass(IInjectedDependency dependency, bool someArbitraryValue) {}
}

How can I set this up with SM to inject the dependency but specify the arbitrary value?

I've tried the following but it doesn't work (I get "There is no argument of type System.Boolean for concrete type IInjectedDependency"):

ObjectFactory.Initialize(x =>
    {
        x.For<IInjectedDependency>().Use<ConcreteDependency>();
        x.For<ISomeClass>().Use<SomeClass>().Ctor<bool>("someArbitraryValue").Is(false);
    });

I think this is only for a constructor with one parameter and thats why it doesn't work with multiple (I've used it for one param constructors and it works fine).

TIA!

m

A: 

Works like it should. Problem on my end.

Mike OBrien