Entity Framework Code First. Cannot ignore custom class indexers in EntityTypeConfiguration - by Indice

Status : 

  Deferred<br /><br />
		The product team has reviewed this issue and has deferred it for consideration at a later time.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 754309 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/18/2012 5:09:01 AM
Access Restriction Public


I get 'Sequence contains more than one matching element'

This error is not a matter of query but a matter of mapping configuration. It seems that regardless the query you are calling the EF code first will throw the error when a duplicate matching property is found on the class. I am guessing that it is looping through PropertyInfos with in the class public setters. There can be duplicate property names either because c# is case sensitive so 'MyProperty', 'myproperty' both map to the same column, or in my case because of custom class indexers.

So for class indexers: The .net framework reflects indexers as properties with parameters. There is currently no way to ignore a custom indexer in an EntityFramework code first mapping file because the lambda expression has no way of expressing these kind of special properties. As this was not enough, my class had an overloaded indexer (hence the error 'Sequence contains more than one matching element')

more on this bug here http://stackoverflow.com/a/11521336/61577
Sign in to post a comment.
Posted by Microsoft on 11/13/2012 at 5:08 PM
Thanks again for your feedback. A fix for this issue was checked in the EF6 codebase at CodePlex. The bug is closed as well.

Entity Framework Team
Posted by Microsoft on 10/23/2012 at 1:31 PM
Thank you for taking the time to provide feedback. We addressed a lot of connect suggestions in our last release, but we weren’t able to address them all. We have copied this issue to our backlog and will consider it for a future release. You can view this suggestion on our public backlog – http://entityframework.codeplex.com/workitem/list/basic?keywords=DevDiv%20[Id=458598].
~Entity Framework Team
Posted by Microsoft on 7/19/2012 at 12:22 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/18/2012 at 5:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)