使用数据关系有什么好处?
我想知道与在数据层本身构建关系相比,在 .NET 中使用 DataRelation 有什么优势?或者这很大程度上是开发人员决定将其逻辑放置在哪一层?
I'd like to know what the advantage of using a DataRelation in .NET is, as opposed to crafting the relationship in the data layer itself? Or is this largely a decision by the developer about which tier to place their logic in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DataSet(及其各种组件)基本上用作基于表的数据的内存中表示,并且对于允许客户端应用程序在断开连接状态下处理数据最有用。因此,DataRelation 通常不应该代替数据库中定义的数据关系。相反,它应该充当其他地方定义的关系的模拟或表示。
恕我直言,构建系统以便仅在客户端应用程序中以 DataRelation 的形式定义数据关系将是一个坏主意。
A DataSet (and its various components) basically functions as an in-memory representation of table-based data, and is most useful for allowing a client application to work with data in a disconnected state. Therefore, a DataRelation shouldn't normally function in place of a data relation defined in your database; rather, it should function as an emulation or representation of that relationship defined elsewhere.
Architecting your system so that a data relation is defined only in your client application in the form of a DataRelation would be a bad idea, IMHO.