MySQL Unknown column 'Extent1.ID' in 'on clause' with EF6

柔情痞子 提交于 2019-12-12 15:10:12

问题


I have the following class structure

public class Question
{
    public long ID { get; set; }
    public string Content { get; set; }
    public DateTime On { get; set; }
    public Member Member { get; set; }
    public List<Answer> Answers { get; set; }
}
public class Answer
{
    public long ID { get; set; }
    public string Content { get; set; }
    public DateTime On { get; set; }
    public Member Member { get; set; }
    public List<Star> Stars { get; set; }
    public List<Reply> Replys { get; set; }
}
public class Reply
{
    public long ID { get; set; }
    public string Content { get; set; }
    public DateTime On { get; set; }
    public Member Member { get; set; }
}
public class Star
{
    public long ID { get; set; }
    public Member Member { get; set; }
}

I need to get the question details, for that i use

Question question = dbContext.Questions.Include("Answers.Replys.Member").Include("Answers.Stars.Member").SingleOrDefault(m => m.ID == Id);

But this statement gives me an exception

Unknown column 'Extent1.ID' in 'on clause'

If I remove one Include or remove Member from any Include it works fine.

I have a similar problem with MySQL EF 6 which is posted here. MySQL version using is MySQL 6.9.7.0.

来源:https://stackoverflow.com/questions/35427561/mysql-unknown-column-extent1-id-in-on-clause-with-ef6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!