title: updating a record throws 'Multiplicity constraint violated.' in asp.net mvc
body: <p>I am developing an application in asp.net mvc and using EF code first for my data access. Here is the model I use :</p>
  
  <pre><code>  public class Culture
      {
          [Key()]
          public int CultureID { get; set; }
  
          [Required()]
          [StringLength(250)]
          public string CultureName { get; set; }
  
          [Required()]
          [StringLength(250)]
          public string CultureDisplay { get; set; }
  
          public virtual List&lt;HomePage&gt; HomePage { get; set; }
  
          public virtual List&lt;Person_Local&gt; PersonLocal { get; set; }
      }
      public class Person
      {
          public int PersonID { get; set; }
          [StringLength(250)]
          public string PersonPicAddress { get; set; }
  
          public virtual List&lt;Person_Local&gt; PersonLocal { get; set; }
      }
  
      public class Person_Local
      {
          //[NotMapped()]
          [Key, Column(Order = 1)]
          [ForeignKey("Person")]
          public int PersonID { get; set; }
  
          [Key, Column(Order = 2)]
          [ForeignKey("Culture")]
          public int CultureID { get; set; }
  
          public string PersonName { get; set; }
  
          public string PersonFamily { get; set; }
  
          public string PersonAbout { get; set; }
  
          public virtual Culture Culture { get; set; }
  
          public virtual Person Person { get; set; }
      }
  </code></pre>
  
  <p>I dont have any problem adding new person and personlocal to db. But when I want to update the person local, as below: </p>
  
  <pre><code>public ActionResult CreatePerson([Bind(Prefix = "Person")]Person obj,
              [Bind(Prefix = "Person.PersonLocal")]IEnumerable&lt;Person_Local&gt; plocals)
          {
              string photo_guid = obj.PersonPicAddress;
  
              if (obj.PersonID != 0)
              {
                  Person p = da.Persons.FirstOrDefault(x =&gt; x.PersonID == obj.PersonID);
  
                  TryUpdateModel(p, "Person");
  
                  if (obj.PersonLocal[0].Person.PersonID != 0)
                  {
                      int cid = obj.PersonLocal[0].Culture.CultureID;
                      int pid = obj.PersonLocal[0].Person.PersonID;
  
                      Person_Local ploc = 
                                        da.Person_Locals.First(x =&gt; x.CultureID == cid      &amp;&amp; x.PersonID == pid);
  
  
  
                     //update ploc 
  
  
                   }
  
                   da.SaveChanges();
            }
  }
  </code></pre>
  
  <p>I got following error :</p>
  
  <p>Multiplicity constraint violated. The role 'Person_Local_Person_Target' of the relationship 'WebApp.Models.Person_Local_Person' has multiplicity 1 or 0..1.</p>
  
  <p>Edited: </p>
  
  <p>I commented </p>
  
  <pre><code>TryUpdateModel(p, "Person");
  </code></pre>
  
  <p>And the it seems the problem has been solved ?!! Why ?!</p>