Why am I getting error “The property X on type Y cannot be set because the collection is already set to an EntityCollection”?
问题 While I was trying to map a collection to another in EF4 I got this error. The property 'ResourceLanguages' on type 'Resource_EF810770B4FCA2E071F38C2F2EE328AAC216CA2A7BF157503E6658A42D7CF53A' cannot be set because the collection is already set to an EntityCollection. I was trying to code like this foreach (var resource in resources) { resourceLanguages = resourceLanguageRepositoty.GetAllByResourceId(resource.Id); resource.ResourceLanguages = resourceLanguages; } Can anyone help me to sort