List all types registered with a Castle Windsor container instance

后端 未结 1 2016
走了就别回头了
走了就别回头了 2020-12-09 16:34

What\'s the easiest way of programatically listing registered types in Castle Windsor?

Thanks

相关标签:
1条回答
  • 2020-12-09 17:21

    Use IKernel.GetAssignableHandlers(typeof(object)):

    IWindsorContainer container = ...
    
    foreach (var handler in container.Kernel.GetAssignableHandlers(typeof(object))) {
        Console.WriteLine("{0} {1}", 
           handler.ComponentModel.Service, 
           handler.ComponentModel.Implementation);
    }
    
    0 讨论(0)
提交回复
热议问题