-
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
Invalid SQL generation using OwnsOne properties with .ToTable() #27126
Comments
Note: the same repros on SQL Server: SELECT [t].[Id], [u].[Id], [u].[AddressLine1], [u].[AddressLine2], [c].[UserId], [c].[Email], [c].[WebUrl]
FROM (
SELECT TOP(@__p_0) [u].[Id]
FROM [Users] AS [u]
) AS [t]
LEFT JOIN [ContactInfo] AS [c] ON [t].[Id] = [c].[UserId] Error:
|
Possible duplicate of #26592 |
/cc @roji |
Confirmed that with the latest daily build (7.0.0-alpha.1.22060.12), the error does not repro. So this indeed looks like a dup of #26592, which was indeed fixed for 6.0.2 (to be released in February). |
Duplicate of #26592 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, everyone.
I have the following model schema:
My
OnModelCreating
method:As you can see, I'm using OwnsOne properties differently.
Address
belongs to the same table.ContactInfo
belongs to the different tableContactInfo
When I run a query
it works perfectly and generates a correct query from the debug mode:
When I run
var users = context.Users .Take(10).ToList();
then an exception is thrown:
Debug query:
I've noticed another 'nice' thing. If I change my query to
var users = context.Users.Take(10).OrderBy(e => e.Id).ToList();
then it works perfectly and generates the following query:
My references:
The text was updated successfully, but these errors were encountered: