title: "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical" issue in entity framework
body: <p>I'm using .NET framework 4.0 with Entity Framework v6 code-first.</p>
  
  <p>I am creating 3 tables ("<strong>Indicadores</strong>", "<strong>Campos</strong>" and "<strong>Codigos</strong>") which use composite primary keys, but I am receiving an error when generating the model:</p>
  
  <blockquote>
    <p>One or more validation errors were detected during model generation:</p>
    
    <p>Codigos_Campos_Target_Codigos_Campos_Source: : The number of
    properties in the Dependent and Principal Roles in a relationship
    constraint must be identical.</p>
  </blockquote>
  
  <p>The code is here:</p>
  
     
  
  <pre><code>public class Indicadores
  {
      [Key, Column(Order = 0)]
      public Int32 Nro_Serie { get; set; }
  
      [MaxLength(31)]
      public string Nombre { get; set; }
  
      public List&lt;Campos&gt; campo { get; set; }
  }
  
  public class Codigos
  {
      [Key, Column(Order = 0), DataType("nvarchar"), MaxLength(31)]
      public string Codigo {get;set;}
  
      [MaxLength(31)]
      public string Descripcion1 {get;set;}
  
      [MaxLength(31)]
      public string Descripcion2 {get;set;}
  
      public Int32 CantidadPesadas {get;set;}
  
      public Int32 PesoTotal {get;set;}
  
      [Key, Column(Order = 1)]
      public Int16 Nro_Campo { get; set; }
  
      [ForeignKey("Nro_Campo")]
      public Campos Campos { get; set; }    
  }
  
  
  public class Campos
  {
      [Key, Column(Order = 0), DataType("smallint"), DatabaseGenerated(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None)]
      public Int16 Nro_Campo {get;set;}
  
      [Required]
      public string Nombre {get;set;}
  
      public List&lt;Codigos&gt; codigo { get; set; }
  
      [Key, Column(Order = 1)]
      public Int32 Nro_Serie { get; set; }
  
      [ForeignKey("Nro_Serie")]
      public Indicadores Indicadores { get; set; }
  } 
  </code></pre>
  
  <hr>
  
  <p>Previously, I used "<strong>Campos</strong>" and "<strong>Codigos</strong>" tables with no error; The problem occurs when I include the "<strong>Indicadores</strong>" table. </p>
  
  <p>Any idea of how can I solve this?</p>