今天遇到的问题:
Hql="select max(SNInfo.Ln) from SNInfo",设置MaxResult(1),执行这条查询时,
返回的是SNInfo对象,其中LN是519,query的返回结果集也不是1。
改为
IQuery q = _coreRepository.ActiveSession.CreateQuery("select max(s.Ln) from SNInfo as s" );
q.UniqueResult();
发现,不能用类名修饰字段,必须用别名。
查找NHibernate源代码:













"in class" 和 as的功能相似?
某些函数,如lower在不同的数据库中语法不同,在NHibernate中用发也不同,这样还怎么跨数据库?







Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So Enumerator()is usually a less efficient way to retrieve
object than Find()
调用例子:


第二个参数:<param name="value">A value to be written to a "?" placeholder in the query string</param>代替?占位符的值
第三个:<param name="type">The hibernate type of the value</param>
后面两个参数会组合成QueryParameters定义如下:
public QueryParameters( IType[ ] positionalParameterTypes, object[ ] positionalParameterValues )