查找表 - 在 n 层架构中放置的位置
我正在通过我的应用程序查找一些查找表。这些是驱动网站上下拉列表的表格。它们没有业务逻辑,但需要从数据库到 UI,同时遵循应用程序的架构。
当前的架构有数据层、业务层和表示层。所有数据库调用都在数据层中(使用模型对象和存储库)。业务层调用数据层,BL对象转换数据层对象。然后,表示层调用业务层并使用业务对象。 (基本上是 UI -> 服务 -> 存储库)
我只是认为在没有业务逻辑时必须通过业务层进行探索是一种浪费。我不介意在该架构中添加查找层或公共层,但我不知道它适合在哪里,也不知道如何合并到当前流程中。任何关于我如何解决这个问题的想法都会很有帮助。
编辑:我想我真的很想知道如何在此处合并公共库,以便我可以向其中添加查找。公共库应该位于业务层和 UI 之间,还是应该“替代”业务层?或者我什至需要一个通用库吗?
I have a few lookup tables that I am in the process of plumbing through my app. These are tables that drive dropdowns on the website. They have no business logic, but they need to get from the database to the UI while following the architecture of the app.
The current architecture has a Data Layer, Business Layer, and Presentation Layer. All database calls are in the Data Layer (using Model objects and Repositories). The Business Layer calls to the Data Layer, and the BL objects transform the data layer objects. The Presentation Layer then calls the Business Layer and uses the Business Objects. (Basically UI -> Services -> Repositories)
I just see it as a waste to have to plumb this through the Business Layer when there is no business logic. I wouldn't mind add a Lookup layer, or Common layer to this architecture, but I don't know where it would fit in or how I would go incorporate in the current flow. Any ideas on how I could go about this would really help.
EDIT: I guess I would really like to know how to incorporate a Common Library in here so I can add the Lookups to that. Should the common library sit between the Business Layer and UI, or should it be a "replacement" for the business layer? Or do I even need a Common Library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在不了解您的架构的情况下...
我建议使用现有的 BusinessLogicLayer 和 BusinessLogic。
这可能看起来多余,因为这些查找查询没有业务逻辑。
但是,至少代码将遵循现有的约定/方法。
如果将来引入业务逻辑或查找条件,您将不必更改PresentationLayer。
Without knowing anything about your achitecture...
I suggest using the existing BusinessLogicLayer and BusinessLogic.
It might seem redundant because there is no business logic for these lookup queries.
But, at least the code would be following existing conventions/approach.
And if in the future businesslogic or lookup conditions were introduced you wouldn't have to change the PresentationLayer.
您应该通过业务层对其进行检查以保持一致性。在查找的第一次迭代中,该层中的代码可能非常薄。
You should plumb it through your business layer for consistency. The code in that layer may be very thin in the first iteration for your lookups.