知识卡片
平面消息隐藏实体关系
业务输入跨越人员、地址等多个实体时,接口需要支持完整操作而不泄露内部关系。
一次业务写入可以携带多个内部实体所需字段,例如人员与地址;调用方只提交一个平面消息,由接口或服务拆成实际存储操作。成功响应再提供“增加地址”等后续动作。
这隐藏了实体关系,却不意味着多次内部写入天然具有原子性。实体分组提示可以帮助转换,但不能成为客户端依赖的存储结构承诺。人工输入过长时,可改为分阶段工作文档收集后提交。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 分布式数据 · 查看原书依据
The safest approach to writing data that includes entity relationships in the underlying data model is to represent the data properties using a “flat view” of the associated data. For example, in our person and address case, a single write operation would contain all the fields needed for both entities.
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第6章《分布式数据》§6.3(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch06.xhtml)
- 结论依据:原文以一次业务写入可以携带多个内部实体所需字段,例如人员与地址;调用方只提交一个平面消息,由接口或服务拆成实际存储操作的方式说明该用途;同节示例与讨论补充了卡内条件和边界。
- 原始内容:The safest approach to writing data that includes entity relationships in the underlying data model is to represent the data properties using a “flat view” of the associated data. For example, in our person and address case, a single write operation would contain all the fields needed for both entities.