score:3
Accepted answer
you can only use supported members in l2e queries, and date
isn't one of those.
one workaround is to break your single l2e query into one l2e query followed by one linq to objects query:
var q = from e in context.entities
select new
{
id = e.id,
datetime = e.datetime
};
var r = from e in q.asenumerable()
select new
{
id = e.id,
date = e.datetime.date
};
Source: stackoverflow.com
Related Query
- Entity Framework object limitations in aggregate LINQ query
- Entity Framework 6 Add nested child object in Parent object in LINQ Query
- Entity Framework object LINQ query Timeout issues
- Entity Framework LINQ query left join into new object instead of null
- Proper Linq Query for objects with many to many relation ship generated with code first entity framework
- Asp.Net Mvc Entity Framework Deserialized object Linq query null object
- Entity Framework Code Most First Efficient Linq Query
- Create nested object on Entity Framework Linq query
- 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
- How to avoid Query Plan re-compilation when using IEnumerable.Contains in Entity Framework LINQ queries?
- Should the order of LINQ query clauses affect Entity Framework performance?
- Entity Framework with LINQ aggregate to concatenate string?
- Entity Framework - Linq query with order by and group by
- Entity Framework 6 Compiled LINQ Query
- Convert string to int in an Entity Framework linq query and handling the parsing exception
- Deleting multiple records with Entity Framework using a single LINQ query
- Entity Framework LINQ Expression on object within object
- Simple conditional LINQ query in Entity Framework 4
- ThenInclude not working for an Entity Framework LINQ query
- Dynamic linq query expression tree for sql IN clause using Entity framework
- Retrieve single Entity Framework entities using a LINQ query or GetObjectKey?
- Entity Framework Linq Query to List - Error when using contains: Only primitive types, enumeration types and entity types are supported
- Entity Framework with Oracle using odp.net not taking parameters in linq query
- How can I view the Entity Framework LINQ query plan cache?
- Entity Framework Core LINQ query with multiple where clauses
- Queryable Linq Query Differences In Entity Framework
- Reusable linq select query in Entity Framework
- Entity Framework Core linq query returns InvalidCastException
- Internal access for entities in Entity Framework makes simple linq where query crash
More Query from same tag
- can't see anonymous type values without using .FirstOrDefault() ?
- LINQ Group and Distinct
- Linq filtering/search logic
- Performing an operation during enumeration
- Get data with db with lambda expression and coalesce
- Linq query on the same table with difference between rows
- Linq: GetElementAt() equivalent for retrieving multiple items?
- Left Join Linq to Entity's Vb.net
- .NET LINQ , List of Orders grouped by CustomerId across three tables?
- LINQ doing individual queries when it should have the data
- Linq on XML get value from nested elements in select
- group by and count with linq vb.net
- Remove objects, and child objects from a list in C# where they match an object property in another list
- Is there a pattern for "first best match" or predicate fallbacks in C#?
- C# MongoDB JOIN Table outerKeySelector IN innerKeySelector
- linq Cannot implicitly convert type 'System.Linq.IQuerable
- C# Generic List.Any() throws System.NullReferenceException
- How to Flatten a dictionary of (int, dictionary)?
- Challenge: LINQ to Convert Hierarchy XML to Linked Objects
- Get last duplicate element in a list
- Create an enumeration of one
- Syntatic sugar for a for-loop counter
- How to perform 'OR' operation between several where conditions in LINQ
- Linq how to use a subSelect as a virtual table in FROM
- Date Difference Logic in LINQ
- error in fetching first element from collection
- set DataSource for DataGridView
- How to handle System.ArgumentOutOfRangeException error when getting values from JSON by Property Name
- Trying to get array of custom object types from array of objects
- How to use linq to map xml to a class?