.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
Post a Comment