Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.EntityFrameworkCore.DynamicLinq - ToListAsync()? #42

Closed
jnal opened this issue Aug 22, 2016 · 1 comment
Closed

Microsoft.EntityFrameworkCore.DynamicLinq - ToListAsync()? #42

jnal opened this issue Aug 22, 2016 · 1 comment

Comments

@jnal
Copy link

jnal commented Aug 22, 2016

EF core 1.0.0 has ToListAsync(). I can see that EntityFrameworkDynamicQueryableExtensions class doesn't have this. Will there be a support on this in the future?

using (var context = new TestContext(_optionsBuilder.Options)) { var queryFirstNameContainsTest = context.Persons.Where(x => x.FirstName.Contains("test")); var test = await queryFirstNameContainsTest.Select("new (FirstName,LastName)").Cast<Person>().ToListAsync(); }

received this error

Test Name: WTW.TMS.Compensation.BasePay.Business.Tests.DynamicEFTests.DynamicEFSelectTest
Test FullName: WTW.TMS.Compensation.BasePay.Business.Tests.DynamicEFTests.DynamicEFSelectTest
Test Source: C:\Projects\Tests\DynamicEFTests.cs : line 26
Test Outcome: Failed
Test Duration: 0:00:08.22

Result StackTrace:
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at Remotion.Linq.Clauses.ResultOperators.CastResultOperator.GetOutputDataInfo(IStreamedDataInfo inputInfo)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func3 func)
at Remotion.Linq.QueryModel.GetOutputDataInfo()
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.SingleResultToSequence(QueryModel queryModel, Type type)
at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateAsyncQueryExecutor[TResult](QueryModel queryModel)
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddAsyncQuery[TResult](Object cacheKey, Func1 compiler) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable1.System.Collections.Generic.IAsyncEnumerable.GetEnumerator()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.d__1291.MoveNext() --- 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.TaskAwaiter1.GetResult()
at Tests.DynamicEFTests.d__2.MoveNext() in C:\Projects\Tests\DynamicEFTests.cs:line 41
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_0(Object state)
at Xunit.Sdk.AsyncTestSyncContext.<>c__DisplayClass7_0.b__1(Object _)
Result Message: No coercion operator is defined between types '<>f__AnonymousType0`2[System.String,System.String]' and 'Domain.Entities.Employee.Person'.

@jnal jnal closed this as completed Aug 22, 2016
@jnal jnal reopened this Aug 22, 2016
@jnal
Copy link
Author

jnal commented Aug 22, 2016

the code below works. this is not an issue.

queryFirstNameContainsTest.Select<Person>("new (FirstName,LastName)").ToListAsync();

@jnal jnal closed this as completed Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant