本文介绍了升级到EF6后 - 该属性不能配置为导航属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个以下类:
[Table("TagSource")]
public class TagSource
{
public TagSource()
{
this.DataSources = new HashSet<DataSource>();
}
[Key]
public int TagSourceId { get; set; }
...
public bool IsHistorical { get; set; }
public Nullable<int> ModifiedEntryId { get; set; }
...
public int? AttachedTagSourceId { get; set; }
[ForeignKey("AttachedTagSourceId"), InverseProperty("TagSourceId")]
public virtual TagSource AttachedTagSource { get; set; }
[ForeignKey("ModifiedEntryId"), InverseProperty("TagSourceId")]
public virtual TagSource ModifiedEntry { get; set; }
}
我正在使用Entity Framework 5,但现在我已经兴奋nuget)到最新版本 - 6,在这样做之后,我遇到一个错误:
I was using Entity Framework 5, but now I have upraged (by using nuget) to newest version - 6, after doing that I'm encountering an error:
我已经读过该主题,但是我没有这样的描述:
I have read that topic, but i have no references like described:EF5 to EF6 upgrade - navigation properties are broken
推荐答案
我也有同样的问题。我删除了 InverseProperty
属性,问题解决了。希望有帮助。
I had the same problem. I removed InverseProperty
attributes and the problem solved. Hope it helps.
这篇关于升级到EF6后 - 该属性不能配置为导航属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!