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

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -