Entity framework EntityFramework引发含糊不清的MatchException

Entity framework EntityFramework引发含糊不清的MatchException,entity-framework,Entity Framework,设置: EntityFramework POCO与代理+懒散加载 如果需要,组件类和零件类都实现IDataErrorInfo。以下代码引发异常: // Context is a singleton here Context.LoadProperty<Part>( partEntity, (e) => e.ChildComponents, MergeOption.OverwriteChanges); 这在EF代理中被覆盖,并更改为 public vi

设置: EntityFramework POCO与代理+懒散加载

如果需要,组件类和零件类都实现IDataErrorInfo。以下代码引发异常:

// Context is a singleton here
Context.LoadProperty<Part>(
    partEntity, 
    (e) => e.ChildComponents, 
    MergeOption.OverwriteChanges);
这在EF代理中被覆盖,并更改为

public virtual EntityCollection<Component> ChildComponents { get; set; }

但这个问题刚刚出现,我无法理解为什么现在没有真正的变化。

我调查了这个问题,发现.NET将索引器(例如从IDataErrorInfo)编译到Item中,因此在名为Item的类和任何具有此类属性的类中引入了某种模糊性。这会导致EF出现问题。这个问题比我想象的更深入地隐藏在我的代码中,并不是所有的信息都出现在最初的帖子中,主要是组件类有一个Item属性。

在我的例子中,我的一个实体有一个标量属性,与关联属性同名,只是大小写不同。这导致了模棱两可的MatchException。
public virtual EntityCollection<Component> ChildComponents { get; set; }