实体框架 – 无法确定依赖操作的有效排序

前端之家收集整理的这篇文章主要介绍了实体框架 – 无法确定依赖操作的有效排序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的模特儿
public string Content { get; set; }

public Faq Reply { set; get; }

public int? ReplyId { get; set; }

public ICollection<Faq> Children { get; set; }

[ForeignKey("WriterId")]
public virtual UserProfile Writer { get; set; }

public virtual int? WriterId { get; set; }

public Status Status { get; set; }

[ForeignKey("DepartmentId")]
public virtual Department Department { get; set; }

public virtual int? DepartmentId { get; set; }

这是我的错误

Unable to determine a valid ordering for dependent operations. Dependencies may exist due to foreign key constraints,model requirements,or store-generated values.

看起来你有一个循环依赖.你收到保存数据的错误

答案在这里:Clean way to deal with circular references in EF?

在这里:Entity Framework 4: inheritance and Associations

猜你在找的设计模式相关文章