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 Query
- 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#
More Query from same tag
- Intersect using custom function in f#
- Grafting LINQ onto C# 2 library
- Retrieving values from a Linq GroupBy
- Retrieve distinct values from datatable using linq vb.net
- Linq outer join and group by with count in select
- Linq to entities if else condions in query
- LINQ - Generate identity for object
- Group by column one, group by column two and then count column two on an EnumerableRowCollection
- Linq Join using Lambda in VB.NET
- Get all objects from a tree with a particular property using Linq
- C# Why is Linq crashing about a Null if the value is not null?
- Comparing an entity with array using LINQ
- Get Attribute name using position from XElement
- How to get index of string found in list and equal to input string
- compare all rows in DataTable - identify duplicate records
- Full join in Linq
- How to fix this lambda expression?
- CRM 2013 - linq query to get accounts for a specific owner
- Max value from list that is smaller than X
- How to convert Sum over partition from T-SQL
- Linq Sort Direction From String
- Cannot select most recent ticket from a collection of tickets
- Generics with Entity Framework Repository
- LINQ variable cast AsEnumerator, yet the view throws error saying its a System.Data.Entity.Infrastructure.DbQuery
- Getting more then one value in the same time from Dictionary
- Accessing Distinct values of List within List for ListView
- LinqToExcel:How to get specific row in Excel
- C# Count Items across an Array of Lists
- LINQ to XML row with two attributes
- using c# generics extension methods to operate on a class and not a collection