0
我有以下方法:IQUERY没有运行预期
ServiceType GetWithValidServices(long ServiceTypeID);
及以下功能:
public ServiceType GetWithValidServices(long ServiceTypeID)
{
IQuery query = CurrentSession.CreateQuery("select dl.ServiceType from Service as dl"
+ "where dl.ServiceType.ID = :id and dl.IsValid = true"
+ "order by dl.HavePriority desc");
query.SetInt64("id", ServiceTypeID);
var dlArt = query.UniqueResult<ServiceType>();
return dlArt;
}
在下面的方法我称之为上面提到的功能:
public ServiceCollection GetService(long ServiceTypeID)
{
ServiceType d = DomainToWebgridMapper.GetWebgridServiceType(DaoFactory.Instance.ServiceTypeDao.GetWithValidService(ServiceTypeID));
return d.Service;
}
我的问题是查询运行不正确。我可以看到服务,但dl.IsValid没有运行的过滤器,也没有按照优先级排序。
我在少数其他方法中使用where子句,并且它工作正常。
我不知道这里出了什么问题。也许有人可以帮助我。
在此先感谢
谢谢,我已经试过了,但查询仍然没有正确运行 – Paks 2012-07-26 10:51:47