EntityType''没有定义键。定义此EntityType的键

时间:2015-01-31 16:28:15

标签: entity-framework code-first

我尝试首先使用代码将数据库添加到我的sql管理工作室,但是我收到了错误" EntityType' Question'没有定义键。定义此EntityType的关键字"所以我将[key]添加到模型中,但我仍然得到相同的错误。

这是我的模特:

  public class Question
{
    [Key]
    public int QuestionId { get; set; }
    public Theme theme { get; set; }
    public string QuestionName { get; set; }
    public IList<Alternatives> alternatives { get; set; }
}

我还能做什么才能知道这是关键?

0 个答案:

没有答案
相关问题