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

Query: TPH query with shared column includes column multiple times. #5909

Closed
ajcvickers opened this issue Jun 30, 2016 · 4 comments
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@ajcvickers
Copy link
Contributor

See InheritanceSqlServerTest.Can._query_all_types_when_shared_column

Note: query returns correct results.

Model:

    public class Drink
    {
        public int Id { get; set; }
    }

    public class Coke : Drink
    {
        public int SugarGrams { get; set; }
    }

    public class Lilt : Drink
    {
        public int SugarGrams { get; set; }
    }

Query:

var drinks = context.Set<Drink>().ToList();

SQL:

SELECT [d].[Id], [d].[Discriminator], [d].[SugarGrams], [d].[SugarGrams] 
FROM [Drink] AS [d]
WHERE [d].[Discriminator] IN (N'Lilt', N'Coke', N'Drink')
@smitpatel
Copy link
Contributor

It is repeated multiple times because metadata has 2 different properties. So while adding to projection it does not seem as duplicate. Migration is the part which merges 2 different properties in on column because all facets being matching. Query does not match such column at present and SelectExpression has no access to relational annotation to identify property with same column name.
@anpete @maumar - Thoughts on how to do this?

@anpete
Copy link
Contributor

anpete commented Jun 30, 2016

@smitpatel Why can't we access the annotation? We have the IProperty.

@smitpatel
Copy link
Contributor

@anpete - Read annotation directly from metadata?

@anpete
Copy link
Contributor

anpete commented Jul 1, 2016

@smitpatel Lets chat.

@rowanmiller rowanmiller removed the pri0 label Jul 6, 2016
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 11, 2016
@ajcvickers ajcvickers modified the milestones: 1.1.0-preview1, 1.1.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants