Open
Description
NHibernate Linq fails to convert OrderBy expression to SQL when projecting to a record type class that has a primary constructor. If I remove the primary constructor of the class I am projecting to then the OrderBy expression works.
//OrderBy fails if object projecting to has primary constructor:
public record SearchCoursesResult(
Guid CourseId,
string CourseName,
Guid SubjectId,
string SubjectName,
string CourseLevel,
string? CollegeCourseCode,
bool CourseIsActive
);
//OrderBy succeeds if object projecting to does not have primary constructor
public record SearchCoursesResult
{
public Guid CourseId { get; init; }
public string CourseName { get; init; }
public Guid SubjectId { get; init; }
public string SubjectName { get; init; }
public string CourseLevel { get; init; }
public string? CollegeCourseCode { get; init; }
public bool CourseIsActive { get; init; }
}