Почему бы не передать свой контейнер IoC?

На этом AutoFac & quot; Лучшие практики & quot; страница (http://code.google.com/p/autofac/wiki/BestPractices), они говорят:

Don't Pass the Container Around Giving components access to the container, or storing it in a public static property, or making functions like Resolve() available on a global 'IoC' class defeats the purpose of using dependency injection. Such designs have more in common with the Service Locator pattern. If components have a dependency on the container, look at how they're using the container to retrieve services, and add those services to the component's (dependency injected) constructor arguments instead.

Так что было бы лучше иметь один компонент "динамически" создать другой экземпляр? Их второй абзац не охватывает случай, когда компонент, который "может" необходимость создания будет зависеть от состояния системы. Или когда компонент A должен создать X номер компонента B.

Ответы на вопрос(4)

Ваш ответ на вопрос