-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Query: GetHashCode(Expression obj) of ExpressionEqualityComparer does not support ExpressionType.Assign #10529
Comments
@BenjiZombie We will try to get a fix for this into 2.1, although it might not make it. However, fixing this exception might still result in an expression tree that EF cannot translate. We prioritize expression trees that come from lambda expressions directly over arbitrary trees that can be build manually or by other tools. You might want to consider submitting a PR to get this fixed sooner. |
Thanks for the quick reply. I'll investigate doing a PR if time allows. |
See #18685 |
Hi there,
I have a homemade mapping/projection library that I use to map/project between DB models and DTOs. In the expression tree that this library builds, there are a few assignments (i.e. Expression.Assign) being made in the logic to support mapping/projection of abstract classes to derived types (i.e. I have the abstract
Field
, and the concreteBooleanField
entities and the abstractFieldDto
, and the concretBooleanFieldDto
DTOs).Here is the relevant part in the resulting expression tree:
Mapping an existing entity model to its DTO counterpart works as expected, however doing a projection fails with the following exception:
I noticed in the code of
ExpressionEqualityComparer.GetHashCode(Expression obj)
, there is no case forExpressionType.Assign
, hence theNotImplementedException
thrown above.Is this something that is not supported, or will be supported by EF?
As a workaround, I am fetching the entity normally, then doing a map to a DTO. However I would prefer support for projection for performance reasons.
Thanks in advance!
Further technical details
EF Core version: 2.0.0
Database Provider: NpgSql
Operating system: Windows 10 Pro
IDE: Visual Studio 2017 15.5.1
The text was updated successfully, but these errors were encountered: