You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SingleOrDefault() with IncludeOptimized returns the first item for not single collection #822
Is it expected that SingleOrDefault() method returns the first element for IQueryable object returned by IncludeOptimized WHEN collection contains more than one element? I didnt find anything about it on your site and was a little bit confused.
changed the title [-]SingleOrDefault() with IncludeOptimized returns the first item[/-][+]SingleOrDefault() with IncludeOptimized returns the first item for not single collection[/+]on Dec 16, 2024
After investigating, due to how our library is made, we will not be able to support this combination. This is more complex as we don't control everything on our side, and a lot of logic is done on the EF side.
You can somewhat use a trick on your side, but I don't recommend it even if it's working:
Activity
[-]SingleOrDefault() with IncludeOptimized returns the first item[/-][+]SingleOrDefault() with IncludeOptimized returns the first item for not single collection[/+]JonathanMagnan commentedon Dec 16, 2024
Hello @magicmanam ,
Thank you for reporting.
We will see if there is something we can do about it.
Best Regards,
Jon
JonathanMagnan commentedon Dec 22, 2024
Hello @magicmanam ,
After investigating, due to how our library is made, we will not be able to support this combination. This is more complex as we don't control everything on our side, and a lot of logic is done on the EF side.
You can somewhat use a trick on your side, but I don't recommend it even if it's working:
Best Regards,
Jon
magicmanam commentedon Dec 23, 2024
Hello @JonathanMagnan! Thanks for the answer!
Maybe it makes sence to add a remark to
IncludeOptimizedmethod's annotation and/or mention about this behavior in the documentation?Anyway, feel free to close this issue. Thanks!
JonathanMagnan commentedon Dec 24, 2024
Hello @magicmanam ,
Thank you for your suggestion. I added a text about this in the limitations section and referenced this issue.
Best Regards,
Jon