score:3
Accepted answer
Well, assignment operator aside, how would you expect your Apply
method to be translated into SQL? Entity Framework doesn't know anything about it, and can't delve into opaque delegates, either.
I suspect what you really need to do is separate out the bits to do in the database from the bits to do locally:
var dbQuery = from p in context.Parent
join phr in context.Child on p.key equals phr.parentkey into pr
select new { p, phr };
var localQuery = dbQuery.AsEnumerable()
.Select(pair => /* whatever */);
Source: stackoverflow.com
Related Articles
- Linq in conjunction with custom generic extension method build error - An expression tree may not contain an assignment operator?
- How to: Use async methods with LINQ custom extension method
- Generic extension method with custom return type
- How To Use C# Linq Predicate with custom Extension Method
- Custom Extension Method in LINQ to Objects to return anonymous objects with comparer
- Custom LINQ provider calling an asynchronous, generic method with reflection fails when getting the Task.Result object
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- LINQ Max extension method gives an error on empty collections
- How do I build Expression Call for Any Method with generic parameter
- LINQ - Writing an extension method to get the row with maximum value for each group
- Add a LINQ or DBContext extension method to get an element if not exist then create with data in predicate (FirstOrCreate)
- Convert linq query expression with multiple froms into extension method syntax
- Using LINQ SequenceEqual extension method with occassionally null properties
- Generic Extension method for LINQ JOIN using 2 columns
- Extension method with optional generic argument
- Dynamic Linq on method called with generic type via reflection
- Linq to SQL: delete record with generic type method
- generic method to get linq result to datatable for select new with multiple selects
- c# Build Error with LINQ syntax in Controller
- Can a LINQ extension method create a new KeyValuePair with a new() .Value when a Where clause isn't satisfied
- Extension method & LINQ to Entities does not recognize the method error
- LINQ extension method for multiple join with multiple GroupBy requirements
- Calling static generic LINQ extension method in PowerShell
- Construct AndAlso/OrElse LINQ expression with custom method
- Extension method with generic Func parameter of other type
- Using custom method inside Linq Select with Entity Framework
- C# - Generic method with linq parameter
- How to use Linq extension method with CodeFluent Entities template?
- Is there any way to encapsulate a simple LINQ query in an extension method that can be used with LINQ to Entities query?
- Passing an IComparer parameter to custom LINQ OrderBy extension method
- Possible bug in RavenDB EmbeddableDocumentStore
- Using LINQ Datarow -> string instead of Datarow -> String[] -> String,
- Performing a time calculation inside a Linq query
- Find duplicate row in a datatable by id - add the duplicate column values as concatented string to a new column then remove dulplicate column
- How to get all items of container in cosmos db with dotnet core
- How to pass (and return) LINQ IQueryable<T> to a Function?
- Using datatables with asp.net c# ,LINQ and stored procedure having pager
- Task Does Not Contain a Definition for Where If Done in One Line of Code
- Linq Join issue in C#
- 'System.Collections.Generic.IEnumerable<short>' does not contain a definition for 'Sum'
- CF Entity Framework searching across compound entities
- I am wondering about the state of connection and impact on code performance by 'yield' while iterating over data reader object
- Linq nested group by to manipulate identity data
- What is the correct way to join 3 tables using EF
- List where Clause
- Whats the proper way to check to see if an entry in a db table is null?
- SQL Linq Many To Many
- VB.Net passing linq-expression as parameter and set object property with that expression
- LINQ Select on string results in char
- Using LINQ to get a list of items where the item contains a part of an item from another list