google-code-export / dataobjectsdotnet

Automatically exported from code.google.com/p/dataobjectsdotnet
0 stars 0 forks source link

Date.Year expression is no being translated in GroupBy scenario #820

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A query:

Query.All().Select(c => new PipeAbonentDocumentReportItemDto() {
  Year = (c.Date != ((Nullable<DateTime>)null))
    ? ((Nullable<Int32>)c.Date.Value.Year)
    : null,
  }).GroupBy(
  g => new PipeAbonentDocumentReportItemDto() {
    Year = g.Year
  },
  (e, g) => new PipeAbonentDocumentReportItemDto() {
    Year = e.Year,
    LineCount = g.Count()
  }
)

Actual grouping is being made by '[c].[Date]' instead of 'CAST(DATEPART(YEAR , 
[b].[Date])  AS integer)'

P.S.
'Order by' clause is translated correctly.

Original issue reported on code.google.com by Dmitri.Maximov on 23 Sep 2010 at 11:47

GoogleCodeExporter commented 9 years ago

Original comment by alexey.g...@gtempaccount.com on 28 Sep 2010 at 7:44