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 two tables, that for 99% of the time I want them to eager load, they are in a master/detail relationship. So in my code I have defined them as eager load. However, there is just one method, that gets called a lot, that just needs a list of the masters, with no details at all. The problem is because of the sheer volume of data, that eager load is slowing down the one method when it should be fast. So I do not have to use a named aggregate, and change every call on these tables, is it possible to disable the eager load in LINQ for just with one call. I have tried to use the .WithAggregate("InvalidName") to see if that would work, but it still loaded everything. Thanks in advance for any and all advice. |
|
|
If eager loading is enabled for an association then its always on unless a named aggregate is defined in which case its lazy by default and eager when the aggregate is specified. A couple of suggestions for handling this however would be to load the data for that table using a stored procedure or view where eager loading doesn't apply. Or alternatively you could perform a projection into that entity which specifies all columns as that also will ignore eager loading.
|
|
|
Hi Jeremy, We finally solved the problem by creating a Stored Procedure, but to be honest, that seems a little messy to me. I was hoping for a flag to disable eager for a single transaction. This might me something worth considering for future versions? |
|
|
Yep agreed, having a query option (and associated LINQ extension method) to toggle this would be sensible. Ill look at adding this in.
|
|