通过 DI 容器注入的替换策略是有效的部署机制吗?

发布于 2024-09-27 02:19:17 字数 153 浏览 1 评论 0原文

我正在创建一个应用程序,它使用 DI 容器将策略注入其中。 部署时,如果我需要更改这些策略,那么使用新策略部署新程序集并修改配置文件以指示 DI 容器使用哪种策略是否是有效的部署策略?

我担心的是,机器上应用程序的版本控制会变得有点模糊,因为不同的 dll 会有不同的版本号。

I'm creating an application which uses a DI Container for injecting strategies into it.
When deployed, if I require those strategies to change, is it a valid deployment strategy to deploy a new assembly with the new strategies and ammend the configuration file for instructing the DI container of which strategy to use?

My concern is that Versioning of the application on a machine then becomes a bit fuzzy as different dlls would have different version numbers.

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

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

发布评论

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

评论(2

朱染 2024-10-04 02:19:18

这是完全有效的,这甚至是依赖项注入的巨大好处之一:它允许模块化开发 - 因此也允许部署:您不必部署所有应用程序,而只需部署修改后的程序集(使用新策略)在你的情况下)。

至于版本控制问题:通常的做法是,一个应用程序由许多具有不同版本号的软件模块(俗称:程序集)组成。这是规则,并不是什么例外。因此,所有 DLL 的版本号列表至关重要......

Thomas

This is totally valid, this even is one of the great benefits of Dependency injection: It allows for modular development - and therefore also deployment: you don't have to deploy all of your application, but only the modified assembly (with the new strategies in your case).

As for the versioning issue: It's common practice that an application consists of many software modules (vulgo: assemblies), which have a different version number. That's the rule, not something exceptional. Therefore, a list of version numbers for all DLLs is crucial...

Thomas

╄→承喏 2024-10-04 02:19:18

DI 的最佳功能之一是模块化应用程序和易于扩展性。我认为您通过使用配置文件并让 DI 加载您的策略来正确执行此操作。

对于版本问题,可以想到ClickOnce部署。这可以减少这个版本问题。

One of the best feature of a DI is Modular Application and easy extensibility.Which i think you doing correctly by using configuration file and let the DI load your strategies.

For Versioing Problem , you can think of ClickOnce Deployment. Which can reduce this version problem.

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