score:1
you should use 'by new' after 'group'. i hope this will help you.
var entries = from entry in _db.entries
group entry by new { entry.name } into groupedbyname
select new
{
groupedbyname.key.name,
numberofcomments = groupedbyname.count(x => x.name != null)
};
Source: stackoverflow.com
Related Query
- linq count error: DbExpressionBinding requires an input expression with a collection ResultType. Parameter name: input
- DbExpressionBinding requires an input expression with a collection ResultType. Parameter name: input
- DbExpressionBinding requires an input expression with a collection ResultType
- DbExpressionBinding requires an input expression LINQ
- Linq projection :DbExpressionBinding requires an input expression with a collection ResultType
- LINQ with Lambda expression - Join, Group By, Sum and Count
- Convert SQL to linq expression with count
- Linq SQL error with one-to-many relationship and orderby complex expression
- Help with Linq expression to return a list of strings based on field count
- Linq expression with multiple input parameters
- Linq in conjunction with custom generic extension method build error - An expression tree may not contain an assignment operator?
- entity framework with linq query and stored expression error
- Error LINQ expression contains references to queries that are associated with different contexts
- The specified LINQ expression contains references to queries that are associated with different contexts error in c#
- LINQ throwing TypeAs expression with input of type 1 and check of type 2 is not supported
- Compiling Error with LINQ Sorting Code Using List<T>
- LINQ expression with mulitple count
- Linq Lambda Error : The specified LINQ expression contains references to queries that are associated with different contexts
- Dynamic Linq Where with Lambda Expression generates Error
- Trouble with a LINQ 'filter' code throwing an error
- Preserve input with LINQ expression using Except instead of Where
- Lambda expression with statement body error in previously working code
- How get max count with min key from list integer with linq written in one expression
- LINQ Expression to Select objects by string property with maximum count of objects in its queue property without duplicates
- The LINQ expression could not be translated - Error with Nullable Id field
- Saved projection expression for re-use in different linq expressions with two source objects
- LINQ Left Outer Join with Group By and Count Producing Error
- "Argument expression is not valid" error with EF4 Linq sub select query
- LINQ with groupby and count
- Linq with group by having count
More Query from same tag
- linq and parallelism - SQL Server
- When called from 'VisitLambda', rewriting a node of type 'System.Linq.Expressions.ParameterExpression' must return a non-null value of the same type
- Using LINQ Group Joins in VB.NET
- using LINQ getting previous and next element
- Next Number Generate in LINQ
- Linq Join Two List , Group By Result And Select Distinct Value
- LINQ query - exception thrown if no match?
- Linq How to Get Average When all values equals null or 0 ? MVC
- Need help to sorting an array in a complicated way c# linq
- Simple question regarding LINQ
- Add new and update existed object into many-to-many table with EF
- Querying unique items by date
- Check if words in string array ends and starts with char and insert new string between them (c#)
- Using 'out' in Linq query
- translate row_number over partition to C# linq
- Can this Aggregate Lambda expression be converted to a LINQ query?
- Trying to combine two tables in LINQ
- Linq dynamic orderby not working
- Adding Items to List using Linq
- how to store multiple values from listview column to a single entry to database asp.net c#
- Performance Difference between LINQ and Stored Procedures
- IQueryable order by two or more properties
- What is the best way to trim a list?
- Merge lists into one
- how to handle the datatable column value is
- A local variable cannot be declared in this scope[Linq/Lambda expression]
- Execute OrderBy with parameter
- Problem with displaying data from the linq query
- Looping list null elements
- EF Core 2.1, force SelectMany to produce LEFT JOIN