dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.78k stars 3.19k forks source link

Return entire entity in projection (select) #17852

Closed dmarlow closed 5 years ago

dmarlow commented 5 years ago

Is it possible to return the entire entity in a projection or to only selectively get specific properties? If the latter, I guess this becomes a feature request since it's tedious to get every single property and have to keep that up-to-date.

Steps to reproduce

The line: Blog = x causes an exception: EF.Property called with wrong property name.

var results = Blogs
    .Include(x => x.Author)
    .Include(x => x.Comments)
    .Select(x => new 
    {
        Blog = x,
        NewestComment = x.Comments
            .OrderByDescending(y => y.DateCreated)
            .FirstOrDefault()
    })
    .ToList();

Stacktrace

   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
   at Microsoft.EntityFrameworkCore.Sqlite.Query.Internal.SqliteSqlTranslatingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)
   at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.Translate(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateExpression(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateLambdaExpression(ShapedQueryExpression shapedQueryExpression, LambdaExpression lambdaExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateWhere(ShapedQueryExpression source, LambdaExpression predicate)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.TranslateSubquery(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.Translate(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.VisitNew(NewExpression newExpression)
   at System.Linq.Expressions.NewExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.Translate(SelectExpression selectExpression, Expression expression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateSelect(ShapedQueryExpression source, LambdaExpression selector)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

Further technical details

EF Core version: 3.0 preview 9 Database provider: SQLite Target framework: .NET Core 3.0 Operating system: Win 10 IDE: Visual Studio 2019 16.2.4

itorian commented 5 years ago

I'm facing this issue when migrated .net core 2.2 to 3.0, here's my query which is buggy after migration:

var orders = await orderService.GetAll()
    .GroupBy(i => new { i.Timestamp.Value.Month })
    .Select(i => new LineChartViewModel()
    {
        Month = i.Key.Month,
        Total = i.Count(),
        Date = i.First().Timestamp.Value,
        Label = i.First().Timestamp.Value.ToString("MMMM") + " " + i.First().Timestamp.Value.Year
    }).ToListAsync();

Error stack:

System.InvalidOperationException: The LINQ expression 'First<Tenant>(GroupByShaperExpression:
KeySelector: new { Month = DATEPART(month, t.Timestamp) }, 
ElementSelector:EntityShaperExpression: 
    EntityType: Tenant
    ValueBufferExpression: 
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.Translate(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.VisitMemberAssignment(MemberAssignment memberAssignment)
   at System.Linq.Expressions.ExpressionVisitor.VisitMemberBinding(MemberBinding node)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.VisitMemberInit(MemberInitExpression memberInitExpression)
   at System.Linq.Expressions.MemberInitExpression.Accept(ExpressionVisitor visitor)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.Translate(SelectExpression selectExpression, Expression expression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateSelect(ShapedQueryExpression source, LambdaExpression selector)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at Kn.Admin.Web.Core.Controllers.TenantController.GetTenantsChart() in C:\Users\abhimanyu\source\repos\kn-tfs\Kn.Admin.Web.Core\Controllers\TenantController.cs:line 67
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

HEADERS
=======
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Cookie: ai_user=Ug8VZ|2019-09-27T10:25:52.393Z; _ga=GA1.1.1609391056.1569579953; _gid=GA1.1.691227988.1571055237; .AspNetCore.Antiforgery.VbLDqharDiM=CfDJ8A3NKip0V_BFjVMVxT034-WQkkyIjdTIqAop1uRYk-A8b3OBW20X5_E_1Oya9KlKSysiq07-JjcQCTqhzVflSRdrwcBm4VyBY677_nRdcQRwuiczM193cKlXOEoTNQiSZQHLyHDTyfKXHwsvf2FjR5M; ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3Dkn-admin-app%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A40561%252Fsignin-oidc%26response_type%3Dcode%2520id_token%2520token%26scope%3Dopenid%2520profile%2520offline_access%2520roles%2520knapi%26response_mode%3Dform_post%26nonce%3D637067401872253169.MWE2MWZhOGMtMmUyNS00ZTI1LThkOWYtNDhiOTFkZTNkYmM5YjNhNzRiODEtOTkxMy00NTI0LTgzN2MtYjI4YzMwZDFmM2U0%26state%3DCfDJ8A3NKip0V_BFjVMVxT034-XsibYY04qWfBuGvCQd0wzna0ses0viogii2fJmAKCLZgbdFKewOGA2hcsFTJnEax7dacB_7H5mK-7nTQ8-xm9BdPsknFLBln2fi7D9DB1xPQoHy2R0k_vBBzPqiBGAaaKQVF7XFYo7TyaMFa69ZTaSW9VMQcP9mdKYX9t_4NJ6ge7Gh1Z4y_dFFIBbw77iw4yX614OWwW6vzI5y4JHpU3wb9zQQDX6MJsRSmdKeyxXJwym1WfOyMK95QYEtzzs_MmUZGleRpIOTbrjc5g-Xena%26x-client-SKU%3DID_NETSTANDARD2_0%26x-client-ver%3D5.5.0.0; idsrv.session=g9BR79-70_jzqj4ZQ3BZoA; .AspNetCore.Identity.Application=CfDJ8A3NKip0V_BFjVMVxT034-VFH1u586OPLlgY3LbsiUe2WnaKKJzStTpzOuxUSB4HwZABZkMYaAUrgLrsJ4aPe0sSUNbAvoYrzrdF_-IsGGwpcfP29_sL8bu59krP3dXrNP_CRq1VxLd2yzUouEqMu970egJ835gtzVeFSfIONKW6hqON0kQbaGXkkBokAkspUOiqkC2vFD2SIeK8JOlP6LXtb1Ftm3wVGvP0zr95bIx7Qs6ywZ4x72w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8v1ir8EOP2CmydXwqQZqVywVSsCbpbu1GTYSWRrv-GyEFerfNrTa9TvcricglfJGSVKlBMOPpJ_gIYHOHlvpuf1amOz6exIXd_PIYrlUxG_-beh5YtgFw2qSQujEna32F2yS5UkaADncjW2_SGjfs6TnsN3VjHzZNZpMbFAV-O2FC4OZu4tAMe-zUVo4yWGoZgbniK-BY7QPxfQsoru-dTtO82TbFx4qE0bXS8qY5fxRM3O7n-x-T09syUD7UIjaZII-02HROdEOhawikMAnQLUxtrNr4F7nCTFmgYGxRab1FK3P_bsDjgLn0l51W8B7WJfvqoB3uAGAYCkwYZVry_9MV9cthsec7uzJz3GKt6SP6sL1Baw64Jn4E9kK81NOyoSiqa7LZli7erxDNMIcEztw0GFEYBxqdgJF9omxzUWsWvcC8Vs2tXzUt42j4pVExCU_DdkpVUM921If9DXA7DSOW38-vNtsLUlPyI1-vg2HIoDRr1TriyMzEUmVwZsRXtp92UQ72625rRLc6lPJO7VqDru0IaDhSnk__lgeo6n0laY1emvlCWtxtG4M0aqEEDLRc94VUO2KTB-tkItxVzSVF6XMNV81FBaYOVmB9npIHS0LKP-8cxGcC-4Uhvm9Xqcpe2wauzyoQ01d_ZHwX3E6DguUHRXnr3jjtttJvcFQ-7ipa-bkUJTuKplO8-A_gHwkYF9UAa8pqx5Uk; .AspNetCore.CookiesC2=TF-0UIeRIv72nZohbiURLPzZ1m7DnXwt625Oma7c_uw; ai_session=riG9a|1571137564561|1571147166484.925
Host: localhost:40561
Referer: http://localhost:40561/tenant
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
X-Requested-With: XMLHttpRequest
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin

If I rollback to .net core 2.2, this works perfectly.

smitpatel commented 5 years ago

@itorian - Your issue is not related to this issue or any other issues you spammed. You are doing GroupBy First. That evaluated on client. EF Core 3.0 does not support client evaluation so it is not supported as the exception message says. See #13805

itorian commented 5 years ago

@itorian - Your issue is not related to this issue or any other issues you spammed. You are doing GroupBy First. That evaluated on client. EF Core 3.0 does not support client evaluation so it is not supported as the exception message says. See #13805

Sorry about spamming which you think, but can you please confirm if this was supported in earlier version of EF Core? We started facing this issue only after migrating from 2.2 to 3.0 and when we rolled back to 2.2 it worked again.

smitpatel commented 5 years ago

It was being evaluated on client. Please see https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaking-changes#linq-queries-are-no-longer-evaluated-on-the-client