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: Optimize usage of GetViewOrTableMappings #28019

Merged
1 commit merged into from
May 13, 2022
Merged

Query: Optimize usage of GetViewOrTableMappings #28019

1 commit merged into from
May 13, 2022

Commits on May 13, 2022

  1. Query: Optimize usage of GetViewOrTableMappings

    Resolves #23572
    
    Following rules define if given entity type is a potential candidate for optional dependent in table sharing case
    - A keyless entity cannot be in table sharing
    - Only root type of hierarchy can be dependent
    - The dependent can be TPH/TPT (or no hierarchy) but no TPC
    - Principal can be any type except non-leaf type in TPC (this is only applied in model validation, no impact on query)
    
    If above conditions indicate it is optional dependent then we need to find the ITableBase it is mapped to find if it is optional dependent
    We find ITableBase for IEntityType (which is also root type)
    - For new generated SelectExpression, first table's ITableBase is the mapping table (regardless of type of TableExpressionBase, if no mapping then we use default)
    - For other scenario the single mapped view/table mapping for the entity type (because of root type, there will only be one mapping) or default mapping in case entity type is not mapped to any view/table
    
    Once we get table and verify it is optional dependent,
    We use required non-PK columns which are not shared with principal entity types to add check for existence. This is necessary and sufficient condition for existence
    smitpatel committed May 13, 2022
    Configuration menu
    Copy the full SHA
    2aae635 View commit details
    Browse the repository at this point in the history