我的 UI 层中有一个设置文件,我需要在业务层中使用它的值。我的 UI 层和业务层位于单独的程序集中。
我无法直接访问业务层中的设置值,因此我目前通过业务层构造函数传递它们。我正在考虑创建一个包含所有设置文件值的类,并将其通过业务层构造函数传递。
这是访问这些值的最佳方法,还是有其他方法?
I have a settings file in my UI layer, and I need to use its values in my business layer. My UI and business layers are in separate assemblies.
I can't access the settings values in the business layer directly, so I currently pass them through the business layer constructor. I am considering making a class that contains all the settings file values and passing it through the business layer constructor.
Is this the best way to access these values, or is there another way?
发布评论
评论(1)
我会把这些设置放在自己的类中。将该类保留在业务逻辑层中,因为这是应该使用它的地方。获取数据访问层中的设置,从业务逻辑层调用。您可以使用单独的类来进行仅涉及信息呈现的 UI 设置。
I would put the settings in their own class. Keep that class in the business logic layer as that's where it should get used. Fetch the settings in the data access layer, called from the Business logic layer. You could use a separate class for UI settings that only concern the presentation of information.