业务对象/自定义类 DAL 设计
我需要一些关于如何处理这种情况的建议。我的应用程序有许多表和映射到这些表的自定义类。让我们使用以下示例(伪代码):
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论