score:3
Apparently the question has been answered before, because of the new framework, the error message is different, and because of how I got to the answer, thinking that projections where interfering with how the indexer was working.
LINQ to Entities does not recognize the method 'System.Linq.IQueryable`
All I had to do was add an AsEnumerable() which converts the result into C# objects, then the select (preserving the logic I originally had) would then add the index to the iterations.
var cities = context.Countries
.Where(s => query.Name == s.Name)
.AsEnumerable() // where the magic happens
.Select(s => new CityDTO
{
new CityDTO()
{
name = s.name,
stateName = s.stateName
population = s.population
}
});
score:-1
Actually that LINQ query simply can be translated into indexing row with dbfunction row_number() over () (at least for postgreSQL) but for now (Feb, 2021) still not supported.
Source: stackoverflow.com
Related Articles
- nested select projection with index in linq using EF Core
- Using LINQ with Lucene for querying an index with live projection
- Nested select with group by using linq
- How to avoid a NullReferenceException when using a nested property via projection with Entity Framework Core
- How to select values within a provided index range from a List using LINQ
- Using Linq with 2D array, Select not found
- EF Core nested Linq select results in N + 1 SQL queries
- select object which matches with my condition using linq
- Select all unique combinations of a single list, with no repeats, using LINQ
- Select object from nested collection using Linq
- How to Select All with a One to Many Relationship Using Linq
- Dynamically generate LINQ select with nested properties
- Select entities with multiple and nested levels without using Include
- Select all rows with distinct column value using LINQ
- Select all unique combinations of a single list, with no repeats, using LINQ (Part 2)
- ImmutableArray<> behaves differently than Array<> for nested Select with index
- SELECT NEW with a potentially null field using LINQ and Entity Framework
- Converting list with nested list to a separate list using Linq
- How do I define a SELECT TOP using LINQ with a dynamic query?
- How to use a LINQ query to include index in Select with F#
- C# Combine two lists with nested lists into one using LINQ
- EF Core Linq Join with OR condition using Method Systax
- joins in Linq using lists<strings> with no id to index from
- How can I select using LINQ for an entry that contains a LIST with more than one row?
- Linq sub query when using a repository pattern with EF code first
- Select data to nested class with LINQ
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- Using custom method inside Linq Select with Entity Framework
- Creating class objects using LINQ with a highly nested XML
- Can't add a new record with an integer value into database by using linq from code C#
- Passing Array of Strings to LINQ Stored Procedure
- statements and return within a lambda expression lambda
- LINQ part of string is contained in list members
- Group list and perform a function on the resulting matching items
- LINQ to SQL Join orderby
- Handle null element in linq
- Unable to compare generic values
- Add Function to entity in LINQ
- Is Aggregate fatally flawed because each into clause is executed separately?
- How to convert data using lambda expression or using any other logic?
- LINQ expression to filter
- Linq to Entities, .Take() on VARBINARY field results in ArgumentException 'DbLimitExpression requires a collection argument
- Multiple LINQ expressions, and dynamic properties
- Confused about Linq query
- Linq return a field or another
- Using LINQ to generate Highchart column table data
- Linq. Missing table
- LINQ contains query custom ordering
- Linq Total Based on Location
- How to perform .Max() on a property of all objects in a collection and return the object with maximum value