Error while conversion of Nhibernate query to generic list

后端 未结 2 803
萌比男神i
萌比男神i 2021-01-02 06:10

I have a simple entity called EmployeeEntity with properties ID, Name, Age, Organisation, and Designat

2条回答
  •  星月不相逢
    2021-01-02 06:55

    When you're querying with select Name, Designation, Age, Organisation..., NHibernate will actually return an IList instance. To overcome this, try rewriting your HQL to select new EmployeeEntity(Name, Designation, Age, Organisation)... and add an appropriate constructor to EmployeeEntity class.

提交回复
热议问题