When using LINQ to Entities, is there a better method than casting to list in order to use unsupported code/extensions?
Tag : chash , By : user103892
Date : March 29 2020, 07:55 AM
I hope this helps you . I find myself needing to do things like this frequently, and I'm just curious if there is a better way. , You can use AsEnumerable(): _people = db.People.Where(...)
.AsEnumerable()
.Distinct(new MyCustomComparer())
.ToList();
IEnumerable<Person> _people = db.People.Where(...);
_people = _people.Distinct(new MyCustomComparer()).ToList();
|
LINQ to Entities does not recognize the method 'Boolean Exists(System.Predicate`1[Entities.Connection])' method
Tag : chash , By : user112141
Date : March 29 2020, 07:55 AM
I wish did fix the issue. The issue here is that Entity Framework does not understand your C# code and cannot parse .Exists(). An alternative way of writing this would be as followed: _context.Notes
.Include(t => t.Connections)
.Where(t => t.CreatedUserId == userId || t.Connections.Any(c => c.UserId == userId));
|
LINQ Group by - linq to entities does not recognize the method 'char get_chars(int32) method
Tag : chash , By : Chris Hanley
Date : March 29 2020, 07:55 AM
With these it helps Entity Framework doesn't know how to translate the char indexer into valid SQL. Instead you can use string.Substring, for example: var output = (from p in db.Products
group p by p.ProductName.Substring(0, 1));
|
c# LINQ to Entities: unsupported type
Tag : chash , By : Tony Z
Date : March 29 2020, 07:55 AM
|
LINQ to Entities does not recognize the method 'Newtonsoft.Json.Linq.JToken get_Item(System.String)' method,
Tag : chash , By : eataix
Date : March 29 2020, 07:55 AM
|