【发布时间】:2010-12-19 02:09:38
【问题描述】:
为了更好地学习 Cocoa 和 Core Data,我决定构建一个包含烹饪食谱的应用程序。但是,在尝试创建 CD 模型时,我已经卡住了。
这是三个简化的类:
Recipe:
name
ingredients
instructions
Ingredient:
name
unit (liter, teaspoon etc)
当然,Recipe 中的成分关系也需要跟踪所需的量。如果我要立即构建一个 SQL 表,我会得到:
Recipe: Ingredient: Recipe_Ingredient:
id id recipe_id
name name ingredient_id
instr unit amount
究竟如何才能将此Recipe_Ingredient 关系放入CD 模型中?我是否只需添加一个包含这些属性的RecipeIngredients 实体?
【问题讨论】:
标签: objective-c cocoa core-data