简体   繁体   English

核心数据关系和数据结构

[英]core-data relationships and data structure

What is the right way to build iPhone core data for this SMS like app (with location)? 为该短信(如位置)(如位置)构建iPhone核心数据的正确方法是什么?
- I want to represent an entity of -我想代表一个实体
conversation with 与...对话
"profile1" “ profile1”
"profile2" “ profile2”
that heritage from a profile entity, 来自个人资料实体的遗产,
and a message entity with: 和带有以下内容的消息实体:
"to" “至”
"from" “从”
"body" “身体”
where the "to" and "from" are equal to "profile1" and/or "profile2" in the conversation entity. 其中“ to”和“ from”等于会话实体中的“ profile1”和/或“ profile2”。
How can I make such a relationships? 如何建立这种关系?
is there a better way to represent the data (other structure)? 有没有更好的方法来表示数据(其他结构)?
Thanks 谢谢

UPDATED 更新

What you describe makes sense. 您所说的很有意义。

Create Profile, Conversation, and Message entities. 创建配置文件,对话和消息实体。

Conversations should have to-one relationships to Profile for both "to" and "from" (the inverse relationships for each will be to-many) and a to-many relationship with Message (the inverse relationship will be to-one). 会话对于“到”和“从”都应具有与Profile的一对一关系(每个反向关系将是一对多的)和与Message的一对多关系(反向关系将是一对一的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM