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