When I try load all my CssFile from my repositories, I get an multiplicity error. When debugging the current existing objects, everything seems to be fine. I've tried to Include() the page but same error occurred.
public CssFile FindByPage(Page page)
{
return cssFiles.Where(f => f.PageId == page.Id).Single();
}
The multiplicity constraint is violated. The role of the relationship Page_CssFile_Target Paycento_Models.DAL.Page_CssFile, the multiplicity 1 or 0 .. 1.
public class Page
{
[Key()]
public int Id { get; set; }
[ForeignKey("CssFile")]
public int CssFileId { get; set; }
public virtual CssFile CssFile { get; set; }
}
public class CssFile
{
public string FileName { get; set; }
[Key()]
[ForeignKey("Page")]
public int PageId { get; set; }
public virtual Page Page { get; set; }
}