通过 DI 容器注入的替换策略是有效的部署机制吗?
我正在创建一个应用程序,它使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是完全有效的,这甚至是依赖项注入的巨大好处之一:它允许模块化开发 - 因此也允许部署:您不必部署所有应用程序,而只需部署修改后的程序集(使用新策略)在你的情况下)。
至于版本控制问题:通常的做法是,一个应用程序由许多具有不同版本号的软件模块(俗称:程序集)组成。这是规则,并不是什么例外。因此,所有 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
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.