title: LINQ + EntityFunctions in asp.net mvc
body: <p>I have such code using EntityFramework Alpha3 (from nuget): </p>
  
  <pre><code>class Member
  {
      [Key]
      public int Key { get; set; }
      public string Forename { get; set; }
      public string Surname { get; set; }
      public string Sitename { get; set; }
      public DateTime? RegDate { get; set; }
  }
  
  class MembersContext : DbContext
  {
      public MembersContext()
          : base("Name=ConnectionString")
      {
      }
  
      public DbSet&lt;Member&gt; Members { get; set; }
  }
  
  public class HomeController : Controller
  {
      //
      // GET: /Home/
  
      public ActionResult Index()
      {
  
          Database.SetInitializer&lt;MembersContext&gt;(null);
          const int memberKey = 1001;
          using (var db = new MembersContext())
          {
              var query = from m in db.Members
                          where
                              m.Key == memberKey
                              &amp;&amp; EntityFunctions.DiffDays(m.RegDate, DateTime.Now) &gt; 0
                          select m;
  
  
              var member = query.FirstOrDefault();
          }
  
          return View();
      }
  }
  </code></pre>
  
  <p>I have tried to use EntityFunctions in fresh ASP.NET MVC project (based on .net 4.5) - it always fails with error: </p>
  
  <pre><code>LINQ to Entities does not recognize the method 'System.Nullable`1[System.Int32] DiffDays(System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime])' method, and this method cannot be translated into a store expression.
  </code></pre>
  
  <p>Same code works completely fine in Console app. Any ideas, what's wrong? </p>