Entity Framework Exception: Ambiguous match found

后端 未结 2 507
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 13:55

I get the error:

Ambiguous match found

During this code on the .Add

var db = new NexusEntities(); 
db.Reports.Ad         


        
2条回答
  •  再見小時候
    2021-01-18 14:01

    This is a "weakness" in EF. It happens when the same property appears in class / subtype hierarchy.

    Most likely you have a hidden field. i.e. a property that has been redefined. When EF looks for the a property it too must use the type/base tree to find the property. But if it finds it twice in the tree, it interprets this as a duplicate. EF doesnt just use the lowest most specific override.

    So property hiding is not possible with EF.

    Check your classes, a property will occur twice somewhere.

提交回复
热议问题