-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ProjectTo doesn't work with EF Core 3 and GroupBy #3245
Comments
|
@lbargaoanu Nope, why would it? EF Core can deal with projections as long as they are executed on serer side. And again, the problem is mapping of byte[] property (RowVersion in my sample) only, not with projections in general. |
If it can deal with them, then just forget about AM and simply write that query using LINQ. Check the execution plan. |
So, instead of fixing what seems to be a bug, you are proposing to ditch AM instead? |
No, I'm explaining how to remove AM from the equation. |
Sorry, I don't follow. Why would I remove it? It's a great tool. Yet it somehow produces wrong mapping for byte array. |
Try mapping without AutoMapper to see if it works.
…On Mon, Oct 21, 2019 at 3:07 PM Miha Markič ***@***.***> wrote:
Sorry, I don't follow. Why would I remove it? It's a great tool. Yet it
somehow produces wrong mapping for byte array.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3245?email_source=notifications&email_token=AAAZQMXVJLOI2SFJPG5FRILQPYDYJA5CNFSM4JC7LFN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB3T2PA#issuecomment-544685372>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZQMTMU2HQPXIIKSM2AXLQPYDYJANCNFSM4JC7LFNQ>
.
|
If it didn't work, I wouldn't be reporting it. I'll be triple checking it, but I'm pretty confident that it works if I do a projection without AM. |
That’s what you’ll need to do because EF Core has a funny habit of
evaluating expressions it doesn’t understand client-side.
…On Mon, Oct 21, 2019 at 3:41 PM Miha Markič ***@***.***> wrote:
If it didn't work, I wouldn't be reporting it. I'll be triple checking it,
but I'm pretty confident that it works if I do a projection without AM.
I'll try comparing expressions of possible as well.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3245?email_source=notifications&email_token=AAAZQMWPFJDK53WLCEER7T3QPYHWTA5CNFSM4JC7LFN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB3XB7Y#issuecomment-544698623>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZQMVRQEQJFOSTRYYHNWLQPYHWTANCNFSM4JC7LFNQ>
.
|
Guys, sorry, was my fault afterall. After digging around, it was my custom ITypeConverter<byte[], byte[]> that is causing these problems. Which I added because of another problem regarding EF row versioning, but I'll create another ticket for it. |
I case you wonder why I went with custom type converter, here is the possible issue with EF Core and here is my stackoverflow question. |
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 bugs. |
Source/destination types
Mapping configuration
Version: x.y.z
Automapper 9.0.0
EF Core 3.0.0
Expected behavior
Should group normally.
Actual behavior
An exception is thrown
System.InvalidCastException: 'Unable to cast object of type 'Microsoft.EntityFrameworkCore.Query.SqlExpressions.ColumnExpression' to type 'System.Linq.Expressions.ConstantExpression'.'
Steps to reproduce
Run this statement
Note that byte[] mapping is causing problems. When removed on model, the grouping works.
The text was updated successfully, but these errors were encountered: