This filters in memory right?

I Just want to make sure I understand this correctly...

search is an object that contains a querystring.

Repo.Query returns an ObjectQuery<T>.

From my understanding the chained linq statements will filter the results after entity framework has returned all the rows satisfying the query. So really ALL the rows are being returned and THEN filtered in memory. So we are returning a bunch of data that we don't really want. There's about 10k rows being returned so this is kind of important. Just like to get my confusion cleared up.

var searchQuery = Repo.Query(search)
                .Where(entity =>
                        entity.Prop1.ToUpper().Equals(prop1.ToUpper()) &&
                .OrderBy(entity => Repo.SortExpression ?? entity.prop1);


Your Repo.Query(string query) function should return IQueryable<T>.

Then you can filter and order without getting all rows first.

IQueryable(Of T) Interface

hope this helps

If this is to SQL, this will most likely create a SQL query and filter on the server and not in memory.

As a matter of fact, the statement above wouldn't actually do anything. It's only when you iterate over it that the query will be executed. This is why certain providers (like the EF to SQL one) can collapse expression trees into a SQL query.

Easiest way to check is to use LINQPAD or the SQL Profiler to see what query is actually is executed.

Need Your Help

Comparing Now.js and Socketstream scalability for a MMO

node.js scalability websocket

If I am to build a real-time MMO, multi-room based, non-persistent world, which offers the best vertical scalability [consider mainly the number of players served on same machine, and ram footprin...