Entity framework code-first null foreign key <p>I have a <code>User</code> &lt; <code>Country</code> model. A user belongs to a country, but may not belong to any (null foreign key).</p> <p>How do I set this up? When I try to insert a user with a null country, it tells me that it cannot be null.</p> <p>The model is as follows:</p> <pre><code> public class User{ public int CountryId { get; set; } public Country Country { get; set; } } public class Country{ public List&lt;User&gt; Users {get; set;} public int CountryId {get; set;} } </code></pre> <p>Error: <code>A foreign key value cannot be inserted because a corresponding primary key value does not exist. [ Foreign key constraint name = Country_Users ]"}</code></p>