title: Comparing DateTime in Entity Framework with an Sql Server Compact database
body: <p>Why this code throws a <code>System.NotSupportedException</code> telling that <code>The specified method 'int? DateDiff(string, DateTime?, DateTime?)' on the type 'System.Data.Objects.SqlClient.SqlFunctions' cannot be translated into a LINQ to Entities store expression</code>, though DateDiff has EdmFunction attribute?</p>
  
  <pre><code>context.Users.Where(f =&gt; System.Data.Objects.SqlClient.SqlFunctions.DateDiff("second", f.LastLogOn, somedatetime) &lt; 0)
  </code></pre>