Sequence contains more than one element error in Entity framework code-first migrations
<p>I created some models, added the migration and then did an update database operation, though at my last update database operation I got the error message saying: </p>

<blockquote>
  <p>Sequence contains more than one element</p>
</blockquote>

<p>Below you can find my migration configuration:</p>

<pre><code>context.Restraunts.AddOrUpdate(r =&gt; r.name,
            new Restraunt { name = "farzi", city = "a", country = "b" },
             new Restraunt { name = "prime", city = "c", country = "d" },
              new Restraunt { name = "lord", city = "e", country = "f" },
              new Restraunt
              {
                  name = "barracks",
                  city = "g",
                  country = "h",
                  Reviews = new List&lt;RestrauntReview&gt;{
                      new RestrauntReview{rating=5,body="good food!",reviewername="vipul"}
              }


              });

        for (int i = 0; i &lt; 1000; i++)
        {
            context.Restraunts.AddOrUpdate(r =&gt; r.name, new Restraunt { name = i.ToString(), city = "nowhere", country = "USA" });
        }
    }
}
</code></pre>

<p>Below also you can find my models definitions.</p>

<pre><code>public class Restraunt
{
    public int Id { get; set; }
    public string name { get; set; }
    public string city { get; set; }
    public string country { get; set; }
    public virtual ICollection&lt;RestrauntReview&gt; Reviews { get; set; }
}


public class RestrauntReview : IValidatableObject
{
    public int id { get; set; } 

    [Required]
    [Range(1,10)]
    public int rating { get; set; } 

    [Required]
    [StringLength(1024)]
    public string body { get; set; }

    [Display(Name="USER NAME")]
    [DisplayFormat(NullDisplayText="ANONYMOUS")]
    public string reviewername { get; set; }
    public int RestrauntID { get; set; }

    public IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext validationContext)
    {
        if (rating &lt; 2 &amp;&amp; reviewername.ToLower().StartsWith("vipul"))
        {
            yield return new ValidationResult("sorry vipul... get out!!");
        }
    }
}
</code></pre>