score:1
Accepted answer
I think what is happening is that, EFCore expects a Collection Or IEnumerable To be able to map to the Collection Property of My Parent Entity
Looks like this is a bug with EF-Core. Maybe I'm overlooking the spec and only Collections should map to collections? As a work around I resolved this with SelectMany and Take.
var messages = query.SelectMany(x => x.Messages.OrderBy(m => m.Created).Take(1))
.OrderBy(x => x.ConversationId)
.ToArray();
score:1
You can force includes with this syntax
var query = this._context.Conversations.Include("Messages").OrderBy(x => x.Id);
Source: stackoverflow.com
Related Articles
- EF Core Loading Entities does not map to Query
- Refactor Linq code and "LINQ to Entities does not recognize the method"
- How does this work? LINQ to Entities triggers loading of assemblies?
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- LINQ to Entities does not recognize ToString using query syntax
- Code disentangle - what does query of T do
- One LINQ query to get counts from several entities when using entity framework core
- How to LINQ Query Code First generated EF6 hierarchical entities (entities within entities)?
- LINQ to Entities does not recognize the method in query
- Reconfigure Linq query to create objects: LINQ to Entities does not recognize the method
- When does EF Core LINQ query result in null coalescing despite SingleOrDefault() would return null?
- Entity Framework Code First - The entity or complex type cannot be constructed in a LINQ to Entities query
- Entity framework linq query Include() multiple children entities
- LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method
- LINQ to Entities does not recognize the method 'System.String Format(System.String, System.Object, System.Object)'
- LINQ to Entities does not recognize the method Int32 get_Item(Int32)
- The data source does not support server-side data paging
- What does this C# code with an "arrow" mean and how is it called?
- How do you construct a LINQ to Entities query to load child objects directly, instead of calling a Reference property or Load()
- How does LINQ expression syntax work with Include() for eager loading
- LINQ to Entities does not recognize the method 'System.TimeSpan Subtract(System.DateTime)' method
- LINQ to Entities does not recognize the method 'System.DateTime GetValueOrDefault()'
- How does deferred LINQ query execution actually work?
- Why LINQ to Entities does not recognize the method 'System.String ToString()?
- Could not find an implementation of the query pattern for source type 'System.Data.Entity.DbSet'
- Entity Framework Core count does not have optimal performance
- LINQ to Entities does not recognize the method 'System.Linq.IQueryable`
- LINQ to Entities does not recognize the method 'System.DateTime AddSeconds(Double)' method, and this method cannot be translated into
- Casting to a derived type in a LINQ to Entities query with Table Per Hierarchy inheritance
- How to replace xml content in conditionally selected elements using linq (VB 2008)
- Group by two parameters and count in linq, considering occurrences of 0
- System.NotSupportedException: 'The LINQ expression node type 'Invoke' is not supported in LINQ to Entities.'
- Getting all of the values for a property for a list of objects
- Linq add condition to all fields
- Dynamically Bind Image to Crystal Report from ViewModel and string type Image Property
- Filter list by date and time MVC/C#
- Dynamic LINQ with Data Objects
- Resolve ParameterExpression to actual Expression
- Using Html.Action and PartialView but get a Duplicate type name within an assembly
- LINQ and group by data nested within a structure
- Select a row only if a field from previous row is less from a field in the active row
- most efficient method for combining query results
- Sorting list in c# with linq
- linq groupby Months and add any missing months to the grouped data
- Separating the column values of DataTable using LINQ
- XML parse nodes and subnodes with LINQ
- LINQ filter list based on property value and filter the properties as well
- How to add index with page numbers using itextshap?
- Are there any connections between Haskell and LINQ?