LINQ-to-SQL still roundtrips for ID lookups (3.5SP1) - by Marc Gravell

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 362313 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 8/18/2008 7:55:57 AM
Access Restriction Public

Description

(actually 3.5SP1 RTM - drop-down needs updating)
In issue 340036 I reported an issue with LINQ-to-SQL performing round-trips for id-lookups. This has been partly fixed in 3.5SP1
[cite: http://blogs.msdn.com/dinesh.kulkarni/archive/2008/08/10/net-fx-3-5-sp1-two-perf-improvements-linq-to-objects-and-linq-to-sql.aspx]

- however, the fix only addresses the Single(pred) use-case; the Where(pred).Single() [more common as a consequence of query syntax] remains broken.
Sign in to post a comment.
Posted by Marc Gravell on 2/19/2009 at 9:14 PM
My sincere thanks. Marc.
Posted by Microsoft on 2/19/2009 at 2:54 PM
Hi,

This bug has now been fixed and will be included in .NET Framework 4.0. The optimization to search the cache first for ID-based lookups will now be done for Single/SingleOrDefault/First/FirstOrDefault(predicate) as well as Where(predicate).Single/SingleOrDefault/First/FirstOrDefault(), where predicate has the same restrictions as before. We will also be updating the documentation to more clearly define in what cases the lookup is attempted.

Thanks,
Sarah Parra
LINQ to SQL Team
Posted by Microsoft on 8/19/2008 at 6:33 PM
We were able to reproduce the issue you are seeing. We are escalating this bug to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release