title: nullable object must have a value in Linq
body: <p>I use following Linq To Entitiy To get the first and only record of my 'siteconfig' Entity :</p>
  
  <pre><code>var site = unitofwork.SiteConfigRepository.Get().FirstOrDefault();
  </code></pre>
  
  <p>But when my application comes to the following code, throws 'nullable object must have a value' :</p>
  
  <pre><code>if (site!= null) { TimeSpan span = DateTime.Now.Subtract((DateTime)site.logindDate ); }
  </code></pre>
  
  <p>And the only nullable type in my entity is a property called logindDate and is of type DateTime.</p>
  
  <p>Any one help me out?</p>