문제

I'm working with StructureMap for my IoC needs.

To make things pleasantly testable, I'm passing IContainer instances around wherever possible, usually as constructor parameters. As a convenience, I'd like to be able to fall back to using ObjectFactory for a parameterless constructor.

The simplest way (I thought) to do this would be to simply get the IContainer the ObjectFactory class wraps and pass that to the other constructor. Unfortunately, I can't find anywhere this instance is publicly exposed.

The question is:

Is there a way to get the IContainer within ObjectFactory so I can handle it as simply as a user-supplied instance?

Alternatively, is there a way to duplicate the configuration of the ObjectFactory into a new Container instance?

Example:

I would like to be able to do the following:

public class MyClass
{
    public MyClass()
    {
        Container = ... // The ObjectFactory container instance.
    }

    public MyClass(IContainer container)
    {
        Container = container;
    }

    public IContainer Container { get; private set; }
}
도움이 되었습니까?

해결책

IIS 7 : http://sadomovalex.blogspot.com/2010/05/fix-dotless-for-iis-7-with-integrated.html

System.WebServer의 핸들러 섹션이 누락되었습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top