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
|
Given two tables with a 1-many relationship:
How do I get a list of all the UserLogins which have (at least one) UserRole record with a Type values in the (set of acceptable values)? e.g. Find ? |
|
|
Boom!
That .Join(....) is a spectacularly inelegant way of writing a join, but hey! ... it works |
|
|
Actually, NO! that is a horrific solution which didn't work. It had the effect of returning me ONLY the UserLogin records, but it sabbotaged all the configured EagerLoading. In the end I got the desired effect (EagerLoading in-tact!) by doing this ...
|
|
|
It would be interesting to see if this could have been achieved in a cleaner way. ... |
|
|
No, I believe the solution you posted above is probably the optimal one given the need to eager load for UserLogin. As a general rule if you want to keep eager loading in play you need to avoid using joins in the query (as this means we typically are loading an initial result set with multiple entities, and we disable eager loading in these cases) so this does mean you need to break it up into a couple of stages as you have above.
|
|
|
Well. Good to know i didn't bark up the entirely wrong tree. :) |
|