1

My problems is that I want to register two types for one interface:

I've checked this articles: https://groups.google.com/forum/#!msg/structuremap-users/2T_WTAjRVJ8/HKsELqJEOi4J
https://groups.google.com/forum/#!topic/structuremap-users/75-1AV1boMw

For<IPageManager>().Singleton().Use<PageManager>().Named("pageManager");
For<IPageManager>().Singleton().Use<EnhancedPageManager>().Named("enhancedPageManager");

And in my controllers:

public class ValuesController
{
    public ValuesController(IPageManager pageManger)
    {
        // Here I want to be instance of page Manager 
    }
}

public class PagesController
{
    public PagesController(IPageManager enhancedPageManger)
    {
        // Here I want to be instance of enhancedPageManger
    }
}

But the problems is that I always receive instance of enhancedPageManger.
How to fix that ?

In the documentation there are example of configuration, but not the usage: http://structuremap.github.io/glossary/#sec3

var container = new Container(c =>
{
   c.For<IFoo>().Use<Foo>();
   c.For<IFoo>().Add<SomeOtherFoo>();
});
mihkov
  • 1,171
  • 13
  • 37

0 Answers0