我正在尝试为我正在运行的 HQL 查询创建一个 DTO 对象,但是,当从我的存储库执行我的 HQL 查询时,它会产生一个 NH 转换错误:
System.InvalidCastException: Unable to cast object of type 'NHibernate.Hql.Ast.ANTLR.Tree.SqlNode' to type 'NHibernate.Hql.Ast.ANTLR.Tree.FromReferenceNode'.
有没有人遇到过这个?
我的 DTO 映射和类如下:
/// <summary>
/// TODO: Update summary.
/// </summary>
public class TaskListItemMapping : ClassMap<TaskListItem>
{
public TaskListItemMapping()
{
ImportType<TaskListItem>();
Id(x => x.TaskCode).GeneratedBy.Assigned();
}
}
/// <summary>
/// A class representing a task list data query result
/// </summary>
public class TaskListItem
{
public virtual int Code { get; set; }
public virtual String Client { get; set; }
public virtual string Matter { get; set; }
public virtual DateTime DueDate { get; set; }
public virtual bool Notepad { get; set; }
public virtual bool Flag { get; set; }
public virtual string Client { get; set; }
public virtual string Issue { get; set; }
public virtual string Grade { get; set; }
public virtual String TaskInitials { get; set; }
public virtual string Description { get; set; }
public TaskListItem()
{
}
}
任何想法表示赞赏!