c# - linq sql - aggregate count -


i have linq returns correct data.

var numemails = (from row in emailbatchproposal   row.emailbatchid == emailbatchid select row.emailbatchproposalid).count(); 

however, if understand linq correctly, not perform optimally. grabs data , walks through list , counts rows. i'd linq (in background) use like:

select count(*) ... 

i trust performance reasons obvious.

does know proper way this?

actually, if linq query used collection implements iqueryable , supports translation underlying sql variant, quite basic functionality translate count function example correctly.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -