温莎城堡 - 组件安装的单一位置?

发布于 2024-09-29 12:59:02 字数 388 浏览 2 评论 0原文

阅读文档(http://stw.castleproject.org/Windsor.Installers.ashx)后,我发现了一个奇怪的部分:

虽然从技术上讲,多次调用 Install 或在安装程序之外注册组件是可以的,但将所有注册封装在安装程序中,并在单次调用 Install 期间安装所有安装程序被认为是很好的做法。在未来的版本中,Windsor 很可能会针对此类用途进行优化。

好的,很好的做法,同意。当我能够在启动时加载所有程序集时,这没问题,但如果不能加载,该怎么办?

假设我的 shell 启动、用户登录、基于角色的程序集、基于操作的程序集等。中型企业应用程序中的正常情况。

有什么想法、评论、注释吗?我对性能权衡特别感兴趣。

After reading the documentation (http://stw.castleproject.org/Windsor.Installers.ashx) I've found a strange part:

Although technically it's OK to call Install multiple times, or register components outside of installers it is considered good practice to encapsulate all registration in installers, and to install all installers during a single call to Install. It is quite possible that in future versions Windsor will be optimized for such usage.

Okay, good practice, agree. This is okay when I'm able to load all my assemblies at startup, but what to do when not?

Let's say my shell starts, user logs in, assemblies coming based on roles, assemblies coming based on actions etc. Normal situation in an mid-sized enterprise application.

Any idea, comment, note? I'm especially interessed in performance trade-offs.

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

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

发布评论

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

评论(1

撩心不撩汉 2024-10-06 12:59:02

如果您无法一次安装所有组件,那么您就是做不到。这只是一个建议。

推荐它的原因是因为一次安装所有组件将为您的应用程序提供一致的体验。如果您稍后添加它们,则某个组件在某一时刻无法解析,稍后会解析,或者会以不同的方式解析。

如果您小心处理此类情况(即您知道自己在做什么),那么您应该是安全的。

If you cannot install all components at once, you just can't. It's just a recommendation.

The reason it's recommended is because installing all components at once will give a consistent experience to your application. If you add them later, a component that would not resolve at one moment, would later on, or would resolve differently.

If you take care handling such cases (i.e. you know what you're doing), you should be safe.

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