业务对象/自定义类 DAL 设计

发布于 2024-08-30 05:09:13 字数 516 浏览 3 评论 0原文

我需要一些关于如何处理这种情况的建议。我的应用程序有许多表和映射到这些表的自定义类。让我们使用以下示例(伪代码):

Public Class Country
Name As String
Language As String
Capital As String
President As String

Public Class State
Name As String
Capital As String
Country As String

Public Class City
Name As String
State As String
Country As String

检索任何这些类的单个对象都是直接的。检索任何这些对象的列表也很简单。

我需要指导的是如何检索这些对象的组合。例如,我们可能需要显示城市名称和国家总统的列表(不包括州级)。我应该使用什么对象来保存该数据?我想避免检索状态数据,因为访问数据库的成本很高。我通常使用中继器来呈现信息,因此我还需要一个可以轻松绑定到中继器的对象。

感谢您的帮助。

I need some advice on how to handle this scenario. My application has many tables and custom classes mapped to those tables. Let's use the following as an example (pseudo-code):

Public Class Country
Name As String
Language As String
Capital As String
President As String

Public Class State
Name As String
Capital As String
Country As String

Public Class City
Name As String
State As String
Country As String

Retrieving an individual object of any of these classes is straight forward. Retrieving lists of any of these objects is straight forward as well.

Where I need guidance is how to retrieve a combination of these objects. For example we may need to display a list of City Names and Country Presidents (excludes the State Class). What object should I use to hold that data? I want to avoid retrieving the State data because trips to the database are expensive. I typically present the information using repeaters so I also need an object that is easily bindable to a repeater.

Thanks for your help.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文