IoC (Windsor) - 什么是“默认接口”?

发布于 2024-12-16 19:18:36 字数 330 浏览 1 评论 0原文

有人可以解释一下“

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

默认界面”和

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

“默认界面”之间的区别吗?

Can someone please explain the difference between

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

and

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

What is meant by a "default interface"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤云独去闲 2024-12-23 19:18:36

寻找一个实现通过删除前导的 I 来实现接口:

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

然而,在我看来,使用此功能有点过度丰富的 1:1接口

It's a heuristic that looks for an implementation of an interface by removing the leading I:

  • IFoo -> Foo
  • IBar -> Bar
  • IKitchenSink -> KitchenSink

However, in my opinion, using this feature smells of an over-abundance of 1:1 interfaces.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文