我想从 NHibernate 得到这个 SQL:
SELECT SUM(color_pages) * SUM(total_pages)
FROM connector_log_entry
GROUP BY department_name
但我在任何地方都找不到任何算术运算 (*) 投影。
这是我到目前为止的代码:
Session.QueryOver<ConnectorLogEntry>()
.SelectList(list => list
.SelectGroup(m => m.DepartmentName)
.WithAlias(() => dto.Department)
.Select(Projections.Sum<ConnectorLogEntry>(m => m.TotalPages))
//.Select(Projections.Sum<ConnectorLogEntry>(m => m.ColorPages))
.WithAlias(() => dto.TotalColorPercentage))
.TransformUsing(Transformers.AliasToBean<DepartmentConsumption>());