After searching the web for
System.Data.Edm.EdmAssociationType :: Multiplicity conflicts with a relational constraint in a role
He continued to follow this post, so here is my problem and solution:
I upgraded a large project from ef4.0 to ef4.1 using the vs ef reverse engineering extension. Our mvc application used metadata and partial parts to decorate ef4.0 objects.
After deleting the metadata files, the project started to work.
The root problem was the [Required] attribute, because the ef poco object was NULL, and my metadata was [Required] in the same property. There used to be compliance with the mvc validation rules, and now ef4.1 used to populate the navigation properties. Removing [Required] off metadatatype fixed the problem.
public partial class AgentAgency { public long OID { get; set; } public long? AgentOID { get; set; } public long? AgencyOID { get; set; } public string ReinsuranceYear { get; set; } public virtual Agency Agency { get; set; } public virtual Agent Agent { get; set; } } public class AgentAgencyMetadata { public Int64 OID { get; set; } [Required] public Int64 AgentOID { get; set; } [Required] public Int64 AgencyOID { get; set; } }
Leblanc Meneses Jan 26 '12 at 6:15 2012-01-26 06:15
source share