知识卡片
仓储以集合接口隐藏存取
仓储把某类需要直达的聚合根呈现为一个概念上的对象集合:调用方按领域条件查找已完整重建的对象,也可添加和移除对象。查询、对象映射和存储增删由仓储封装,使调用方不必编排 SQL、结果集和重建步骤,仍以模型术语表达需求。这是接口提供的“像内存集合”幻觉,不表示全部对象必须常驻内存。参见[[重建实体须保留原身份]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第06章|Repositories · 查看原书依据
A REPOSITORY represents all objects of a certain type as a conceptual set (usually emulated). It acts like a collection, except with more elaborate querying capability.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第46章《原书第06章|Repositories》(源文件:_epub-src/0321125215_ch06lev1sec3.html;图6.18、6.21)
- 结论依据:原文定义仓储为特定类型对象的概念集合,提供增删和按条件返回完整对象的接口,把数据库查询和映射留在实现内部;图6.18、6.21展示客户端与底层存储的分隔。
- 原始内容:A REPOSITORY represents all objects of a certain type as a conceptual set (usually emulated). It acts like a collection, except with more elaborate querying capability. ... Keep the client focused on the model, delegating all object storage and access to the REPOSITORIES .