0
p.AuthorsReference.EntityKey = new System.Data.EntityKey("PetitionsContainer.Authors", "Id", authorId);
但我得到的PetitionsContainer.Questions
实体参加QuestionAuthor
关系。现在
0 related 'Author' were found. 1 'Author' is expected.
,该Author
与标识authorId
已经在数据库中。
确实每个问题都必须有1位作者。
虽然,我不能使用AuthorsReference
而不是p.Authors.Add(new Author())
之类的东西吗?
如果您发布的代码,XML或数据样本,** **请在高亮文本编辑器这些线路上,并点击了“代码示例”按钮('{}')编辑器工具栏可以很好地格式化和语法突出显示它! – 2011-05-29 14:22:19