inversion-of-control - IoC (Windsor) - 什么是 "Default Interface"?

标签 inversion-of-control castle-windsor

有人可以解释一下两者之间的区别吗

container.Register(AllTypes.FromAssemblyContaining(typeof(BigCompanyRepository))
 .WithService.DefaultInterface()


container.Register(AllTypes.FromAssemblyContaining(typeof(BigCompanyRepository))
 .WithService.AllInterfaces()

“默认界面”是什么意思?

最佳答案

这是一个启发式 looks for an implementation of an interface by removing the leading I :

  • IFoo -> Foo
  • IBar -> 酒吧
  • IKitchenSink -> KitchenSink

  • 然而,在我看来,使用这个功能有点 over-abundance of 1:1 interfaces 的味道。 .

    关于inversion-of-control - IoC (Windsor) - 什么是 "Default Interface"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8184814/

    相关文章:

    php - Laravel ServiceContainer 和 Facade(初学者)

    dependency-injection - 使用 IoC 容器连接依赖项的首选方式是什么?

    inversion-of-control - SignalR 和 CaSTLe Windsor 的正确 Hub 依赖生命周期管理

    c# - 解决Command Handler对caSTLe windsor的依赖

    c# - 是否可以在 CaSTLe Windsor 中提供依赖于另一个组件属性的服务?

    php - 我必须将数据依赖性从 Controller 中移出(并移入工厂中)吗?

    c# - 为多个接口(interface)注册相同的实现

    asp.net-mvc - PerRequestLifetimeManager 和 Task.Factory.StartNew - 使用 Unity 进行依赖注入(inject)

    c# - 在 CaSTLe 中注册组件后注册拦截器

    caSTLe-windsor - 检查已注册组件的实现的正确方法是什么?