2011-08-28 111 views

回答

2
Feed feed = _session.CreateCriteria<Feed>() 
    .Add(Restrictions.Eq("DataId", "[VARIABLE PARAMETER]")) 
    .AddOrder(new Order("_id", false)) 
    .SetMaxResults(1) 
    .List<Feed>() 
    .FirstOrDefault(); 

,這將導致類似:

select TOP 1 * from Feeds where DataId = ??? Order By Id desc 

應該沒有從性能的角度來看difference