Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Expecting client eval warnings on Last and LastOrDefault query extensions #6929

Closed
julielerman opened this issue Nov 3, 2016 · 3 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@julielerman
Copy link

julielerman commented Nov 3, 2016

Steps to reproduce

A simple Last or LastOrDefault query.

db.MyEntities.LastOrDefault();

I'm using the SQL Server provider.
Provider is configured to throw on client eval.

The issue

Actual query against database is not filtered:

I was seeing this in the ILoggerProvider logging and then verified in SQL Profiler:

SELECT [s].[Id], [s].[Name]
FROM [Samurais] AS [s]

Therefore I can only assume the full set is returned and the Last evaluation is happening in memory.

I can see that the [throw on client eval] config is working because an Average method does cause an exception to throw.

No exception thrown for Last or LastOrDefault,

system

EF Core version: 1.1.0-preview1-final
Operating system: windows 10
Visual Studio version: VS2015

@divega divega added the type-bug label Nov 4, 2016
@divega divega added this to the 1.2.0 milestone Nov 4, 2016
@divega
Copy link
Contributor

divega commented Nov 4, 2016

We should also double-check if/when we can translate Last.

@maumar
Copy link
Contributor

maumar commented Nov 4, 2016

If the query has order by, we could reverse it (asc->desc, desc->asc) and use First/FirstOrDefault instead

@julielerman
Copy link
Author

yeah ...translating last would be very subjective, TOP 1 is also subjective I suppose since it's possible (in linq and in TSQL) to use it without an order by. Would be easier to blame the database if it just had a BOTTOM expression ;)

@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Nov 4, 2016
@ajcvickers ajcvickers changed the title Expecting client eval warnings on Last and LastOrDefault query extensions Query: Expecting client eval warnings on Last and LastOrDefault query extensions May 9, 2017
@divega divega added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. labels May 10, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants