我需要限制从数据库返回的客户 bo 的数量,因为我正在搜索部分客户名称,而目前在搜索“a”时我得到了 600 多个 bo。我想将其限制为 20。我目前的代码是
public IEnumerable<Customer> FindCustomers(string partialCustomerName)
{
if (string.IsNullOrEmpty(partialCustomerName))
throw new ArgumentException("partialCustomerName must be at least one character long");
var criteria = Criteria.Create<Customer, string>(cust => cust.CustomerName, Criteria.ComparisonOp.Like, partialCustomerName + "%");
return Broker.GetBusinessObjectCollection<Customer>(criteria);
}