Hi,
I get this error when I try to filter a string readonly property:
Eccezione generata: 'System.InvalidOperationException' in Microsoft.EntityFrameworkCore.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Eccezione generata: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'Dc6XDD5v9mxLyyypeL63oqa9jPGzD6bu1FJDHIMCCt4'.
System.InvalidOperationException: The LINQ expression 'Where<Card>(
source: OrderByDescending<Card, Nullable<DateTime>>(
source: Where<Card>(
source: DbSet<Card>,
predicate: (c) => (Unhandled parameter: __pngruppo_0).Contains(c.IdAccessPoint) && c.Stato.Value == 1),
keySelector: (c) => c.DataInserimento),
predicate: (c) => c.Cognome.ToLower().Contains("t"))' 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.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|8_0(ShapedQueryExpression translated, <>c__DisplayClass8_0& )
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
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 Telerik.DataSource.Extensions.QueryableExtensions.Count(IQueryable source)
at Telerik.DataSource.Extensions.QueryableExtensions.CreateDataSourceResult[TModel,TResult](IQueryable queryable, DataSourceRequest request, Func`2 selector)
at Telerik.DataSource.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request)
at Telerik.DataSource.Extensions.QueryableExtensions.<>c__DisplayClass3_0.<ToDataSourceResultAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at Bipoint.Data.Model.BipointService.GetCards_Inseriti_PN(DataSourceRequest request) in C:\Users\francesco\Documents\myprojects\2Next\Projects\Bipoint\prove\BipointB\Data\Model\BipointService.cs:line 31
at Bipoint.Pages.Pn.ReadItems(GridReadEventArgs args) in C:\Users\francesco\Documents\myprojects\2Next\Projects\Bipoint\prove\BipointB\Pages\Pn.razor:line 62
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Telerik.Blazor.Components.TelerikGridBase`1.ProcessData()
at Telerik.Blazor.Components.TelerikGridBase`1.OnFilterChange(FilterDescriptorBase filter)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Telerik.Blazor.Components.Grid.GridFilterHeaderBase`1.Filter(FilterDescriptor filterDescriptor)
at Telerik.Blazor.Components.Grid.GridFilterHeaderBase`1.OnValueChanged(Object newValue)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.Server.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.JSInterop.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.Server.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.JSInterop.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.Server.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.JSInterop.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.Server.dll
Eccezione generata: 'System.InvalidOperationException' in Microsoft.JSInterop.dll
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
Eccezione generata: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.Server.dll
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 17300.942ms 101
Eccezione generata: 'System.InvalidOperationException' in Microsoft.JSInterop.dll
this is the grid definition:
<TelerikGrid Data="@Inseriti" Height="100%" Class="fill-height"
Pageable="true" Sortable="true" Groupable="true"
PageSize=25 TotalCount="@Total"
OnRead=@ReadItems
FilterMode="Telerik.Blazor.GridFilterMode.FilterRow">
<GridColumns>
<GridColumn Field="@(nameof(Card.Numero))" Title="Barcode" />
<GridColumn Field="@(nameof(Card.Cognome))" Title="Cognome" Groupable="false"/>
</GridColumns>
</TelerikGrid>
the Card is a EF class:
public partial class Card
{
public int IdCard { get; set; }
public int IdPatient { get; set; }