问题
Is it possible to perform a select top (n) query in llblgen pro?...not LINQ. If so, how can I achieve that using the SelfServicing?
回答1:
Just use the GelMulti overloads that accepts the maxItemsToReturn parameter:
int itemsToReturn = 10;
OrderCollection orders = new OrderCollection();
orders.GetMulti(null, itemsToReturn);
This is the generated SQL:
SELECT TOP(@p2) [Northwind].[dbo].[Orders].[CustomerID] AS [CustomerId], ...
FROM [Northwind].[dbo].[Orders]
Parameter: @p2 : Int64. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 10.
来源:https://stackoverflow.com/questions/6837187/llblgen-pro-select-top-n-equivalent-query