title: Entity Framework Code First - DbNull Convention
body: <p>My problem is I have an existing table that I can not modify that contains <strong>fields that are nullable.</strong></p>
  
  <p>I have a model that I <strong>do not want nullable</strong> properties.</p>
  
  <p>What I want to do is have a convention (I presume this is how) where I can set the <strong>default value</strong> to use based on the models property type when DBNull is encountered from the database.</p>
  
  <ul>
  <li>ints/double = 0</li>
  <li>string = ""</li>
  <li>bool = false</li>
  </ul>
  
  <p>Pretty sure this was simple to do in NHibernate but I can't find out how to do this in EF.</p>
  
  <p>I am using the latest EF package from nuget which I believe is EF 4.2.</p>