Linq to SQL Error with Many-to-Many table

Posted by Matt Connolly on Stack Overflow See other posts from Stack Overflow or by Matt Connolly
Published on 2010-06-11T00:26:41Z Indexed on 2010/06/11 0:32 UTC
Read the original article Hit count: 411

Filed under:
|

I am getting the following error with linq-to-sql when I try to access a many-to-many collection:

Members 'Int32 XXX' and 'Int32 YYY' both marked as IsPrimaryKey and IsDbGenerated.

The statement is true, in that both of those columns are primary key integers with identity insert. The table I am trying to access has a foreign key to both YYY and ZZZ, and then ZZZ has a foreign key to XXX. There doesn't appear to be anything wrong with my data structure. I tried setting "Child Property" to false on the ZZZ->YYY relationship, but it didn't change anything.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about linq-to-sql