Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework - Where Clause

Let's say i have a table named User. When I use the Entity Framework to get the records i do like this:

var db = new Context();
var users = db.Users;

It return all the users in my table. OK. If i do this:

var fooUsers = db.Users.Where(u => u.Name == 'foo');

It will give me all the users with name 'foo'. OK. My question is: The entity framework make a query like:

select * from user where name = 'foo'

Or it load all the users and filter them on the server with lambda expression?

like image 966
Rodrigo Manguinho Avatar asked Dec 04 '22 19:12

Rodrigo Manguinho


1 Answers

The Sql submitted to your database will contain your where clause. You can use SQL Server Profiler to watch as queries are submitted to your DB.

like image 135
Larry Gasik Avatar answered Dec 31 '22 03:12

Larry Gasik