知识卡片
对象存储型数据库应贴近对象模型
当关系数据库主要承载领域对象的持久状态时,表结构和对象模型应保持容易理解的对应关系。可适度限制复杂对象关联,或在数据库规范化上作权衡,以简化映射并维护聚合完整性;不要求机械的一对象一表。即使映射工具能跨越差异,映射规则仍须能从代码或配置中看清,避免两个重叠模型长期分叉。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第06章|Designing Objects for Relational Databases · 查看原书依据
When the database is being viewed as an object store, don't let the data model and the object model diverge far, regardless of the powers of the mapping tools. Sacrifice some richness of object relationships to keep close to the relational model. Compromise some formal relational standards, such as normalization, if it helps simplify the object mapping.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第47章《原书第06章|Designing Objects for Relational Databases》(源文件:_epub-src/0321125215_ch06lev1sec4.html)
- 结论依据:原文限定“数据库主要作对象存储”这一情形,主张对象与数据模型接近、映射透明,允许为简单映射对对象关系和关系规范作折中,但不要求一对象一表。
- 原始内容:When the database is being viewed as an object store, don't let the data model and the object model diverge far, regardless of the powers of the mapping tools. Sacrifice some richness of object relationships to keep close to the relational model. Compromise some formal relational standards, such as normalization, if it helps simplify the object mapping.