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'm getting odd results in the generated query when attempting to select 1 record with LINQ's Single() method. .Single(u => u.EmailAddress == 'xxx'); Generates a SQL query that ends with: OFFSET 0 ROWS FETCH NEXT 2 ROWS ONLY Whereas .Where(u => u.EmailAddress == 'xxx').FirstOrDefault(); Generates a SQL query that ends with: OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY Shouldn't the .Single() method also fetch just 1 row? |
|
|
No, the behaviour of .Single is that it needs to assert that there was just a single result so it checks for the case of more than one by selecting a maximum of 2 rows. First is only looking for the first row.
|
|
|
Ah. I see. Thanks for the clarification. |
|