title: Entity Framework 6 SqlFunctions DateDiff not implemented in nuget package
body: <p>I just downloaded the nuget packages for entity framework 6 (EntityFramework.dll Version 6.0.0.0 Runtime Version v4.0.30319 and EntityFramework.SqlServer Version 6.0.0.0 Runtime Version v4.0.30319) to my 4.5 Framework solution (it is in multiple projects)</p>
  
  <p>In one of the projects I have both referenced and tried to implement the <code>DateDiff</code> Sql Function</p>
  
  <pre><code>RepositoryFactory.CreateReadOnly&lt;MyEnity&gt;()
   .Where(at =&gt; at.AccessedDate.HasValue 
                &amp;&amp; at.CreatedDate &gt;= startDate &amp;&amp; at.CreatedDate &lt;= endDate
                &amp;&amp; System.Data.Entity.SqlServer.SqlFunctions.DateDiff("ss", at.CreatedDate, at.AccessedDate.Value) &gt; 0)
   .GroupBy(at =&gt; at.Participant.Id)
   .Select(at =&gt; new TimeOnSite
       {
           TimeSpentInSeconds = at.Sum(p =&gt; p.AccessedDate.Value.Subtract(p.CreatedDate).TotalSeconds), 
           ParticipantId = at.Key
       }).ToList();
  </code></pre>
  
  <p>To my surprise, I received a not supported exception when running the code. When I looked at the source in <code>System.Data.Entity.SqlServer.SqlFunctions</code>, all of the <code>DateDiff</code> functions had no implementation, they only throw <code>NotSupportedException</code>s. An example is below:</p>
  
  <pre><code>    /// &lt;summary&gt;
  /// Returns the count of the specified datepart boundaries crossed between the specified start date and end date.
  /// &lt;/summary&gt;
  /// 
  /// &lt;returns&gt;
  /// The number of time intervals between the two dates.
  /// &lt;/returns&gt;
  /// &lt;param name="datePartArg"&gt;The part of the date to calculate the differing number of time intervals.&lt;/param&gt;&lt;param name="startDate"&gt;The first date.&lt;/param&gt;&lt;param name="endDate"&gt;The second date.&lt;/param&gt;
  [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "datePartArg")]
  [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "endDate")]
  [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "startDate")]
  [DbFunction("SqlServer", "DATEDIFF")]
  public static int? DateDiff(string datePartArg, DateTime? startDate, DateTime? endDate)
  {
    throw new NotSupportedException(Strings.ELinq_DbFunctionDirectCall);
  }
  </code></pre>
  
  <p>I also tried using <code>System.Data.Linq.SqlClient.SqlMethods.DateDiffSecond</code> which is implemented, but get the following exception: </p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'Int32 DateDiffSecond(System.DateTime, System.DateTime)' method, and this method cannot be translated into a store expression.</p>
  </blockquote>