score:2
Accepted answer
I found a solution via linq provider. You have to project the grouped Items explicitly via Select() and property by property on the group result, e.g.:
var groupedItems = _collection
.AsQueryable()
.GroupBy(pv => pv.ArticleNumber, (key, group) => new
{
key,
Items = group.Select(groupItem => new ProductVersion { PropertyA = groupItem.PropertyA, ... })
})
...
Source: stackoverflow.com
Related Articles
- Cannot get group items from group in GroupBy on IMongoQueryable mongodb c# driver linq statement
- How to create MongoDB MultiKey index on attribute of items in an array .NET Driver
- LINQ - groupBy with items in several Group
- Group items and select specific item from each group with LINQ
- Removing a single item from an enumerable source when the items are equal
- The given value of type String from the data source cannot be converted to type int of the specified target column
- Linq query to group items and query from the top item in each group
- LINQ Select on GroupBy in MongoDB C# driver 2.1
- creating Linq to sqlite dbml from DbLinq source code
- GroupBy Mongodb with Driver C#
- MongoDB .NET Driver Group By Time Range
- MongoDb C# Driver with Group and Project using Aggregate() query giving exception
- Select group from a List<T> matching a condition that cannot be directly specified on a property
- Linq/C#: Selecting and summing items from the result of a group by?
- Retrieve n items from each group in linq
- How do I group items from a collection using LINQ and return the shaped data according the collection type
- Cannot exclude from a list items contained in another list with Linq
- select items from first group in collection LINQ (C#)
- get count of all the grouped items in all groups from IEnumerable<IGrouping<TKey, TSource>> GroupBy
- EF5 Code First (Error cannot be inferred from the usage)
- c# Linq or code to extract groups from a single list of source data
- Filter data from MongoDB with .NET driver
- Mongodb c# driver Linq query Group by
- Exception thrown Getting items from group using fluent api
- Get a list made up of a list of grouped items from a source list
- Select items by ID from another list of items - Local sequence cannot be used in LINQ to SQL
- How to get duplicate items from a list using LINQ?
- Value cannot be null. Parameter name: source
- LINQ: Select where object does not contain items from list
- How to Quickly Remove Items From a List
- Solution For Updating LINQ to SQL Files After Database Schema Change
- Getting unable to create a constant value of type Linq error
- How Do I count the number of occurrences in the IEnumerable
- What is the easiest way to find the LINQ statement for a SQL statement
- Issue with LINQ IN clause when filter value is empty but works with filter values
- LINQ join is not using Equals from provided EqualityComparer, uses GetHashCode instead
- how to insert the database multiple gridview choises
- Distinct ComboBox Items
- Is it possible to use a conditional inside where clause in LinQ?
- How to do a simple OR query with LINQ?
- C# Reading multiple elements with same name using LINQ to XML
- Optimising a linq query to be as fast as doing the same in sql
- Lambda Expression to get 3 field values
- Need advice on how to best deal with the storing/unboxing of different types in a list and what is more optimal in my case
- Entity Framework right join to fill user settings
- Convert string to decimal in group join linq query
- Using datatables with asp.net c# ,LINQ and stored procedure having pager
- LINQ - Dynamic OrderBy in VB.Net
- Trouble combining Linq Expressions into a Func
- Group and Sum With Select Many C#?