0

我有以下代码,但 NHibernate 无法识别自定义 C# 函数。

var query = Session.QueryOver<MyObject>().Select(
            Projections.Group<MyObject>(x => GetDateTimeOffset(x.Date)),
            Projections.Sum<MyObject>(x => x.TotalBytes));

public DateTime GetDateTimeOffset(DateTime date)
{
    ..............
}
4

2 回答 2

1

你不能,因为它不知道如何将你的函数翻译成 sql。

于 2012-10-04T07:48:08.210 回答
-1

考虑使用命名查询

于 2012-10-04T08:17:24.480 回答