StructureMap IoC problem getting the instance in runtime

Posted by user274269 on Stack Overflow See other posts from Stack Overflow or by user274269
Published on 2010-05-06T11:06:45Z Indexed on 2010/05/06 13:28 UTC
Read the original article Hit count: 196

Filed under:
|

i have 2 concrete types "CategoryFilter" & "StopWordsFilter" that implements "IWordTokensFilter".

Below is my setup:

ForRequestedType<IWordTokensFilter>().TheDefaultIsConcreteType<CategoryFilter>()
            .AddInstances(x =>
            {
                x.OfConcreteType<StopWordsFilter>();
            }
        );

The problem is the run-time when structure map auto inject it on my class, bec. i have arguments with same plugin-type:

public ClassA(IWordTokensFilter stopWordsFilter, IWordTokensFilter categoryFilter)

i'm always getting CategoryFilter in my first argument but it should be stopWordsFilter.

How can i setup this in a right way? thanks in advance

© Stack Overflow or respective owner

Related posts about structuremap

Related posts about ioc