vb.net - System.Linq.Dynamic library - need Count() example -
i need elegant solution dynamic selecting/grouping/ordering via linq2entities (vb.net/vs2012).
and i'm trying use system.linq.dynamic library (http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx)
this construŃtion works fine
dim testquery= testdb.testtable.select("new(field1)").groupby("new(field1)", "it")
but 1 (found example somewhere on blogs/so) generates error:
dim testquery= testdb.testtable.select("new(field1, count())").groupby("new(field1, count())", "it")
the error "no applicable method 'count' exists in type 'testtable'"
i know library born dead, official ms solution dynamic queries expressions-trees kinda scary. :-)
if aim retrieve count of rows in testtable
each value of field1
, have thought want firstly groupby
field1
, select
afterwards. reverse order of select
, groupby
, remove count()
groupby.
Comments
Post a Comment