Skip to content

Add View, TVF and SqlQuery mapping support for complex types #34627

Description

@AndriySvyryd

Related to #31235

Activity

  1. added this to the Backlog milestone on Sep 6, 2024
  2. self-assigned this
    on Sep 6, 2024
  3. added theissue type on Jun 15, 2025
  4. kirolous-nashaat commented on Sep 27, 2025

    @kirolous-nashaat
    Contributor

    Hello @AndriySvyryd , am looking forward to work on this issue.
    I looked at CreateViewMapping , and it seems that we are not adding runtime mappings for complex types (we do at CreateTableMapping)

    Is adding the foreach loop just like createtablemapping is enough to fix this ?
    something like this commit: 0d1f0c1
    we also have to change some type params from IEntityType to ITypeBase; just like table mappings

    the only concern i have after further thoughts:

    public virtual async Task Update_complex_type_with_view_mapping(bool async)

    this test does fail , but it test that the select expression throw exception, which shouldn't be the case; as we should query complex type with no issues
    the issue is with the update logic using select expression translation first then trying to update
    it still fails with an exception but different one sql command exception as it's trying to update the view not the table

  5. kirolous-nashaat commented on Sep 28, 2025

    @kirolous-nashaat
    Contributor

    looping @roji as he worked on that test above

  6. AndriySvyryd commented on Oct 10, 2025

    @AndriySvyryd
    MemberAuthor

    something like this commit: 0d1f0c1

    Generally, on the right track, but GetViewOrTableMappings should still only return one set of mappings

    it still fails with an exception but different one sql command exception as it's trying to update the view not the table

    The bulk update logic should be changed to only consider table mappings

  7. kirolous-nashaat commented on Oct 12, 2025

    @kirolous-nashaat
    Contributor

    Generally, on the right track, but GetViewOrTableMappings should still only return one set of mappings

    I didn't change this part. it still return one mapping

    The bulk update logic should be changed to only consider table mappings

    does this have to be in the same pr ?
    this change is more complex than just adding metadata for this issue.

    I can add a boolean forUpdate (deafult: false) to indicate if the sql translator is for update or read

    for example _sqlTranslator.TryBindMember will pass the new parameter to be true, and pass it down to
    structuralTypeProjection.BindComplexProperty
    to pass it down to SelectExpression.GenerateComplexPropertyShaperExpression

    then we can only return the table mapping inside

    but that leaves us with an issue that the StructuralTypeProjectionExpression containerProjection is still referencing the view not the table , so it will still fail with the old exception (in case of table+view mappings). is that okay ?

  8. 4 remaining items

  9. modified the milestones: Backlog, 11.0.0 on Nov 24, 2025
  10. added a commit that references this issue on Nov 26, 2025
    8c820a1
  11. added a commit that references this issue on Dec 3, 2025
    1b1ad14
  12. roji commented on Dec 14, 2025

    @roji
    Member

    @AndriySvyryd is this fixed by #37072, or are we still missing metadata support for complex types?

  13. AndriySvyryd commented on Dec 15, 2025

    @AndriySvyryd
    MemberAuthor

    TVF and SqlQuery support is still missing

  14. roji commented on Dec 16, 2025

    @roji
    Member

    Understood. FWIW I'm doing some pretty heavy refactoring to support TPC (#35025), and the hack currently in place to support SqlQuery won't be easy to carry forward. So we'll soon need proper support for it.

  15. modified the milestones: 11.0.0, Backlog on Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions