.net - how to use count on a groupby using extension methods? -


i need use count(*) sql server on linq, how can use extenstion methods ? here trying

var test = empire.case_offence.join( empire.offences , w => w.offenceid ,                         x => x.id ,                       ( w , x ) => new { w.id , w.offenceid , x.name  } )                        .groupby( ww => new {ww.name, ww.id,ww.offenceid } ) ; 

tnx :)

try:

var test = empire.case_offence.join( empire.offences , w => w.offenceid ,                         x => x.id ,                        ( w , x ) => new { w.id , w.offenceid , x.name  } )                        .groupby( ww => new {ww.name, ww.id,ww.offenceid } )                        .select ( g => new { key = g.key, count = g.count() } ); 

test set of anonymous types 2 parameters - key - group-by key, , count - number of items key.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -