测试 CreateSQLQuery
我使用 NHibernate CreateSQLQuery 方法来获取我部门的 DTO 对象。
string query = @"SELECT * FROM Departments";
IList<Object[]> resultList = Session.CreateSQLQuery(query)...
而且效果很好。但我也想编写一个测试,但当我编写时它失败了:
[Test]
public void CanGetTreeDto()
{
IList<DepartmentDto> resultList = _departmentRepository.GetTreeListDto(idContract);
...
}
它抛出 SQLiteException 并写入“无法执行查询”。有人可以帮忙吗?
I use NHibernate CreateSQLQuery
method to get DTO objects of my departments.
string query = @"SELECT * FROM Departments";
IList<Object[]> resultList = Session.CreateSQLQuery(query)...
and it works well. But also I want to write a test and it fails when I write:
[Test]
public void CanGetTreeDto()
{
IList<DepartmentDto> resultList = _departmentRepository.GetTreeListDto(idContract);
...
}
It throws SQLiteException
and writes "could not execute query". Could anybody help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要临时映射:
此外,您可能需要明确列及其名称。
You need ad-hoc mapping:
Also, you might need to be explicit about the columns as well as its names.