-
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: Where() on derived property fails with undefined property on base class exception #7499
Comments
Navigation rewrite ignores the conversion applied onto navigation. Sample test is in https://github.com/aspnet/EntityFramework/tree/propertyonderivedtype7499 Passing to @maumar |
working on a fix now |
…rty on base class exception Problem was that we were not taking type differences and expression converts in various places during compilation. We sometimes remove converts when processing expressions, but then not accounting for them when we re-assemble the visited expression. This caused many scenarios involving casts (e.g. accessing properties/navigations on derived types) to fail. Fix is to start compensating for those where necessary. Created helper methods for EF.Property method call, member access and assignment and using them instead of regular Expression APIs. Also fixed unrelated issue in the SqlTranslatingExpressionVisitor - when trying to translate MethodCall expression, we would force client evaluation, if arguments to the function was a subquery - this is not ideal, since we can translate some of the subqueries (ones that return single result).
…rty on base class exception Problem was that we were not taking type differences and expression converts in various places during compilation. We sometimes remove converts when processing expressions, but then not accounting for them when we re-assemble the visited expression. This caused many scenarios involving casts (e.g. accessing properties/navigations on derived types) to fail. Fix is to start compensating for those where necessary. Created helper methods for EF.Property method call, member access and assignment and using them instead of regular Expression APIs. Also fixed unrelated issue in the SqlTranslatingExpressionVisitor - when trying to translate MethodCall expression, we would force client evaluation, if arguments to the function was a subquery - this is not ideal, since we can translate some of the subqueries (ones that return single result).
…rty on base class exception Problem was that we were not taking type differences and expression converts in various places during compilation. We sometimes remove converts when processing expressions, but then not accounting for them when we re-assemble the visited expression. This caused many scenarios involving casts (e.g. accessing properties/navigations on derived types) to fail. Fix is to start compensating for those where necessary. Created helper methods for EF.Property method call, member access and assignment and using them instead of regular Expression APIs. Also fixed unrelated issue in the SqlTranslatingExpressionVisitor - when trying to translate MethodCall expression, we would force client evaluation, if arguments to the function was a subquery - this is not ideal, since we can translate some of the subqueries (ones that return single result).
…rty on base class exception Problem was that we were not taking type differences and expression converts in various places during compilation. We sometimes remove converts when processing expressions, but then not accounting for them when we re-assemble the visited expression. This caused many scenarios involving casts (e.g. accessing properties/navigations on derived types) to fail. Fix is to start compensating for those where necessary. Created helper methods for EF.Property method call, member access and assignment and using them instead of regular Expression APIs. Also fixed unrelated issue in the SqlTranslatingExpressionVisitor - when trying to translate MethodCall expression, we would force client evaluation, if arguments to the function was a subquery - this is not ideal, since we can translate some of the subqueries (ones that return single result).
fixed in c6a0602 |
@maumar - Please file a bug for clean up too. |
We found a workaround for this issue.
|
Consider the following model:
MessageSender
andMessageRecipient
are abstract classes that have different implementation depending on their kind.To get the "inbox" I can issue the following query:
However, to get the "outbox" where the query is run on the Sender property, I cannot
The following exception is thrown:
Further technical details
EF Core version: 1.1.0
Database Provider: SqlServer
Operating system: Windows 10
IDE: Visual Studio 2015
The text was updated successfully, but these errors were encountered: