Skip to content

DateTime.xxxx are not supported in SelectGroup #1985

Closed
@aQsu

Description

@aQsu

DateTime.xxxx are supported in Where/Select, but when I try to use them in a SelectGroup, I get
Failed: NHibernate.QueryException : could not resolve property: MyDate.Year of: Shared.Entity.MyEntity error. Small POC

var afterYear2017 = _sessionFactory.GetCurrentSession().QueryOver<MyObject>()
    .Where(x => x.MyDate.Year > 2017)
    .SelectList(list => list
        .Select(x => x.MyDate.Year)
        .Select(x => x.MyDate.Month))
    .List<object[]>();

-> works, but

var grouped = _sessionFactory.GetCurrentSession().QueryOver<MyObject>()
    .SelectList(list => list
        .SelectGroup(x => x.MyDate.Year)
        .SelectGroup(x => x.MyDate.Month))
    .List<object[]>();

fails with the errormessage above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions