Reputation: 488
I have a function that returns a max number of items that are active.
I would like to be able to make the returned results be sorted in random order.
public IList<Widgets> GetWidgetsToDisplay(int maxToGet)
{
var query = CommonSessionManager.GetSession().CreateCriteria<Widgets>()
.Add(Expression.Eq("IsDeleted", false))
.Add(Expression.Eq("IsActive", true));
return query.SetMaxResults(maxToGet).List<Widgets>();
}
Upvotes: 1
Views: 263