mvc and castle windsor

When I register components with castle's container in my app startup - should I see the registered classes being instantiated when I debug.

_container = new WindsorContainer();
_container.Register(
  AllTypes.FromAssemblyContaining<ValidationPatterns>()
                    .BasedOn(typeof(IValidator<>))
                    .WithService.Base());

Should I be able to see each of the relevant classes that fit the types ie inherit from IValidator, being instantiated?

Hope that makes sense


Windsor instantiates components on-demand, ie when they're resolved and no suitable instance (according to component lifestyle) is found. They're not instantiated at registration-time.

See "How components are created" for a more thorough explanation of the process.

链接地址: http://www.djcxy.com/p/59864.html

上一篇: 在Castle Windsor 3中,覆盖单元测试中现有的组件注册

下一篇: mvc和城堡温莎