相互依赖的组件的设计模式

时间:2021-09-01 14:12:36

We are building a "configurator" application for conveyors. Basically user comes in and picks a model, then start picking the parts they want. Some components have dependencies on other components. E.g. if I pick Part A, then I am required to select 1 or more Part B's. It is somewhat similar to configuring a PC at Dell.com. The app will also provide suggestions on parts/components.

我们正在为输送机构建“配置器”应用程序。基本上用户进入并选择模型,然后开始挑选他们想要的部分。某些组件依赖于其他组件。例如。如果我选择A部分,那么我需要选择一个或多个B部分。它有点类似于在Dell.com上配置PC。该应用程序还将提供有关零件/组件的建议。

Based on this info, I am researching if there is an existing pattern(s) that would allow us to make this easy to maintain and design. Any thoughts, ideas? Are there any open source projects that have similar functionality I can borrow ideas/patterns?

基于这些信息,我正在研究是否存在可以使我们易于维护和设计的现有模式。有什么想法,想法?是否有任何具有类似功能的开源项目我可以借用想法/模式?

I am mostly interested in how to define "rules" between components without hardcoding the rules/dependencies.

我最感兴趣的是如何在不对代码/依赖项进行硬编码的情况下在组件之间定义“规则”。

Thanks for any help.

谢谢你的帮助。

Not that it should matter, but we are building this in .NetFramework 3.5/Asp.Net

并不重要,但我们正在.NetFramework 3.5 / Asp.Net中构建它

1 个解决方案

#1


1  

Without a good reason to do otherwise, I'd keep it simple and each part would have a list of dependent parts.

没有充分理由不这样做,我会保持简单,每个部分都有一个依赖部分列表。

#1


1  

Without a good reason to do otherwise, I'd keep it simple and each part would have a list of dependent parts.

没有充分理由不这样做,我会保持简单,每个部分都有一个依赖部分列表。