title: NullReferenceException with Nullable DateTime despite null check
body: <p><code>GetTodayItemCount()</code> attempts to get today's item count using <code>CreatedDtt</code> in the <code>Items</code> model. Because <code>CreatedDtt</code> is a Nullable Datetime (<code>DateTime?</code>), I use a ternary operator within the <code>Where</code>'s lambda expression to make sure I am not trying to access the date of a null value later on in my equality comparison.</p>
  
  <p>However, I still get the classic <code>NullReferenceException? Object reference not set to an instance of an object</code> error, and I can confirm that <code>row.CreatedDtt.Value.Date</code> is where the issue is at.</p>
  
  <pre><code>  public Int64 GetTodayItemCount()
          {
              OrmLiteConnectionFactory dbFactory = new OrmLiteConnectionFactory(dbConn, SqlServerDialect.Provider);
  
              using (IDbConnection db = dbFactory.Open())
              {
                  SqlExpression&lt;Items&gt; itemMatch = db.From&lt;Items&gt;()
                       .Where(row =&gt;
                          (row.CreatedDtt.HasValue ?
                          row.CreatedDtt.Value.Date : DateTime.MinValue) == DateTime.Today
                        );
  
                  Int64 itemCount = db.Count(itemMatch);
                  db.Close();
  
                  return itemCount;
              }
          }
  </code></pre>
  
  <p>How is <code>row.CreatedDtt.Value.Date</code> being accessed when I am checking for its valid value beforehand, and how can I accomplish the desired outcome of <code>GetTodayItemCount()</code> without getting a <code>NullReferenceException</code> error?</p>
  
  <p>Since the solution doesn't seem to be as straightforward as I had predicted, I am adding the stack trace below in case there is any use in it:</p>
  
  <pre><code>   at ServiceStack.OrmLite.SqlExpression`1.GetQuotedColumnName(ModelDefinition tableDef, String memberName)
     at ServiceStack.OrmLite.SqlExpression`1.GetMemberExpression(MemberExpression m)
     at ServiceStack.OrmLite.SqlExpression`1.VisitMemberAccess(MemberExpression m)
     at ServiceStack.OrmLite.SqlExpression`1.Visit(Expression exp)
     at ServiceStack.OrmLite.SqlExpression`1.VisitBinary(BinaryExpression b)
     at ServiceStack.OrmLite.SqlExpression`1.Visit(Expression exp)
     at ServiceStack.OrmLite.SqlExpression`1.VisitBinary(BinaryExpression b)
     at ServiceStack.OrmLite.SqlExpression`1.Visit(Expression exp)
     at ServiceStack.OrmLite.SqlExpression`1.VisitLambda(LambdaExpression lambda)
     at ServiceStack.OrmLite.SqlExpression`1.Visit(Expression exp)
     at ServiceStack.OrmLite.SqlExpression`1.AppendToWhere(String condition, Expression predicate)
     at ServiceStack.OrmLite.SqlExpression`1.Where(Expression`1 predicate)
     at GroupRedemptionsScanner.DBHandlers.GetTodayItemCount() in [directory/file/line number etc]
  </code></pre>