This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a scenario where I need to eager load a selection of child records. For example, I have a stock item parent record, each parent record has a unknown number of child records which show the transactions for the each stock item. In our application, when ever we select a stock item it should select up to the last 20 transactions. There may not be 20 transactions in the table, there may be 1000's of transactions for each stock item in the table. But for performance reasons, we only the last 20 by date to be eager loaded. Is there any way to achieve this? |
|
|
You can't do that with eager loading: eager loading will always select *all* child records. You can do it with an explicit query, e.g. parent.Query(p => p.Children).Take(20); Note you must use the Query operator if you want to load only a subset: if you write parent.Children.Take(20), then LightSpeed will load the entire Children collection, then return the first 20. |
|
|
Thanks for the prompt reply, and the information regarding using the Take options. |
|