score:2
Accepted answer
use tolist()
before groupby
and it will work as expected.
filemovementrepository.getall()
.where(fm => repository.getall().select(f => f.id).contains(fm.fileid) && fm.transferredbyid == userid)
.include(f => f.user).include(f => f.file).theninclude(f => f.category)
.orderbydescending(f => f.movedon)
.tolist()
.groupby(f => f.fileid)
.select(f=>f.first())
.tolist();
Source: stackoverflow.com
Related Query
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities
- LINQ - Does the Where expression return new instance or reference to object instance
- What is the Efficiency and Performance of LINQ and Lambda Expression in .Net?
- How to wrap Entity Framework to intercept the LINQ expression just before execution?
- The LINQ expression could not be translated and will be evaluated locally
- The LINQ expression node type 'Invoke' is not supported in LINQ to Entities in entity framework
- Get the parameter value from a Linq Expression
- LINQ to Entities does not recognize the method 'Int32 Int32(System.String)' method, and this method cannot be translated into a store expression
- Get the earliest date in a LINQ expression
- LINQ to Entities does not recognize the method 'Int32 ToInt32(System.Object)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method, and this method cannot be translated into a store expression
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- The LINQ expression could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation EF Core 3.1
- Linq and the Equality Operator: Expression of type 'System.Int32' cannot be used for parameter of type 'System.Object'
- Does this LINQ code perform multiple lookups on the original data?
- How to understand the following C# linq code of implementing the algorithm to return all combinations of k elements from n
- What is the equivalent of XML PATH and Stuff in Linq lambda expression (GROUP_CONCAT/STRING_AGG)?
- The LINQ expression node type 'Lambda' is not supported in LINQ to Entities
- The LINQ expression could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- LINQ to Entities does not recognize the method 'Boolean HasFlag(System.Enum)' when creating the expression via System.Linq.Expressions.Expression
- Left outer join using LINQ -- understanding the code
- How to reuse a linq expression for 'Where' when using multiple source tables
- Get the ordinal position while creating selected Item in a LINQ expression
- The parameter '***' was not bound in the specified LINQ to Entities query expression
- How does linq actually execute the code to retrieve data from the data source?
- LINQ Source Code Available
- The LINQ expression could not be translated
More Query from same tag
- How do I compose Linq Expressions? ie Func<Exp<Func<X, Y>>, Exp<Func<Y, Z>>, Exp<Func<X, Z>>>
- Generic Object Cache
- Linq, filter out multiples
- A specified Include path is not valid. The EntityType 'DB_A50B96_aljawdahlabModel.LAB_RESULTS'
- Returning the wrong type - cast?
- Remove Duplicate Rows and Count in C# DataTable
- How to write a query in order to achieve the orderby descending clause for an uninitialised generic collections such as List of integers in c#?
- Display list of distinct book names from LINQ query
- Use indexOf() function in LINQ in vb.net or C#?
- Display list from database using linq in vb.net
- How to JOIN two data tables using LINQ and Where condition?
- Custom Linq Ordering
- Dynamic Order By Entity Framework
- Linq with HashTable Matching
- ASP.NET LINQ to XML how to reach an node/element just giving the name?
- Do multiple calls to Distinct() matter
- LINQ to SQL or classic ADO.NET?
- linq mysql query into int array
- LINQ to SQL: How to setup associations between two tables to populate a list of strings
- Get values from stored procedure to class in c# using linqToSql
- LINQ to join a lists of list-items into one list
- MVC 3 passing large data (5MB)
- Group dictionary by multiple properties of key
- Why Expression.Call is throwing parameters error
- In a datacontext are inserted values not available within the datacontext until after submitchanges?
- Filtering Xdocument by multiple values
- MVC Linq using GroupBy Min Max and returning view
- C# List Join List And Filter From Another List
- Linq vs MS Enterprise Library DAAB
- Visual basic LINQ error