Closed Rayvid closed 4 years ago
Which version? Have you tried adding the Cacheable()
method before the ToListAsync()
method?
Cacheable after OrderBy works, thanks. So in general pattern is to put Cacheable after last IQueryable? What will be cached then, only filtered data got to this point? Or statement works like key - cache will work only for same statement?
yes, yes, yes!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.
Summary of the issue
Message: System.InvalidCastException : Unable to cast object of type 'EFSecondLevelCache.Core.EFCachedQueryable
1[Whatever.Model.PricingEntities.PriceCalculationParameter]' to type 'System.Linq.IOrderedQueryable
1[Whatever.Model.PricingEntities.PriceCalculationParameter]'.Environment
All
Example code/Steps to reproduce:
Output:
Test Name: CalculateRoughReservedEndTime_WithReservedAmountAndStartingWithinPaidTimeInterval_ShouldReturnTheSameEndTime(Monday) Test FullName: Whatever.Backend.Tests.Service.PriceCalculationServiceTests.CalculateRoughReservedEndTime_WithReservedAmountAndStartingWithinPaidTimeInterval_ShouldReturnTheSameEndTime(Monday) Test Source: C:\Users\gkisonas\Projects\Whatever\Whatever.Backend.Tests\Service\PriceCalculationServiceTests.cs : line 2824 Test Outcome: Failed Test Duration: 0:00:07.111
Result StackTrace:d46.MoveNext() in C:\Users\gkisonas\Projects\Whatever\Whatever.Backend\Services\PriceCalculationService.cs:line 934
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Whatever.Backend.Tests.Service.PriceCalculationServiceTests.d 71.MoveNext() in C:\Users\gkisonas\Projects\Whatever\Whatever.Backend.Tests\Service\PriceCalculationServiceTests.cs:line 2841
--- End of stack trace from previous location where exception was thrown ---
at NUnit.Framework.Internal.AsyncInvocationRegion.AsyncTaskInvocationRegion.WaitForPendingOperationsToComplete(Object invocationResult)
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunAsyncTestMethod(TestExecutionContext context)
Result Message: System.InvalidCastException : Unable to cast object of type 'EFSecondLevelCache.Core.EFCachedQueryable
at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable
1 source, Expression
1 keySelector) at Whatever.Backend.Services.PriceCalculationService.1[Whatever.Model.PricingEntities.PriceCalculationParameter]' to type 'System.Linq.IOrderedQueryable
1[Whatever.Model.PricingEntities.PriceCalculationParameter]'.