食谱集合的模型(实体框架)

时间:2016-12-22 18:02:15

标签: database entity-framework model-view-controller

我不确定如何在Entity Framework中设置此数据库。 我有这些模特:

public class Recipe
    {
        public int RecipeId { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public string Difficulty { get; set; }
        public IEnumerable<Ingredient> Ingredients { get; set; }

    }

    public class Ingredient
    {
        public int IngredientId { get; set; }
        public string Name { get; set; }
        public IEnumerable<Recipe> Recipes { get; set; }

    }

但我需要添加度量(单位)金额。它应该是升和克。我应该在哪里添加这个?我现在的想法是:

  • 第三个实体。但我该如何设置呢?
  • 将其放入成分中但我不能在另一份食谱中重复使用成分

稍后将在ASP.NET MVC项目中显示所有内容。

0 个答案:

没有答案