1
에 ICriteria 번역은NH 나는이 코드 조각을 변환하고 싶은 QueryOver
public IList<T> ListByQueryOver(Expression<Func<bool>> expression)
{
IList<T> ret = new List<T>();
using (ITransaction tx = m_session.BeginTransaction(IsolationLevel.ReadCommitted))
{
try
{
ret = m_session.QueryOver<T>().Where(expression)
.List<T>();
tx.Commit();
}
finally
{
if (tx.IsActive)
tx.Rollback();
}
}
return ret;
}
처럼 뭔가 QueryOver
public IList<T> ListByCriteria(ICriteria criteria, int maxResult)
{
IList<T> ret = new List<T>();
using (ITransaction tx = m_session.BeginTransaction(IsolationLevel.ReadCommitted))
{
try
{
ret = criteria
.SetMaxResults(maxResult)
.List<T>();
tx.Commit();
}
finally
{
if (tx.IsActive)
tx.Rollback();
}
}
return ret;
}
와 함께 사용할 수 있지만, 컴파일되지 않습니다. 오류 메시지 : "QueryOver에서 'T'매개 변수로 사용하려면 참조 유형이어야합니다.
이 호출을 일반적으로 호출 할 수 있습니까?
무엇이 잘못 되었나요?
는 스테파노 감사
작동합니다. 고맙습니다. –