Skip to content

Update type mapping/converters to make translation data available for query generation #15979

Description

@ajcvickers

From #10265 (comment)

Notes from planning:

  • We will add ordering metadata to value conversions, which will then be available on the type mapping
  • If conversion is not order-preserving, then we throw if an order-based operation is used.
    • For example less than, greater than, min, max.
    • This could include order-by, but note, that commonly any fixed ordering can fine.
  • Add API to allow these operations anyway

Activity

  1. self-assigned this
    on Jun 10, 2019
  2. added this to the 3.0.0 milestone on Jun 10, 2019
  3. modified the milestones: 3.0.0, Backlog on Jun 28, 2019
  4. removed their assignment
    on Aug 31, 2024
  5. added theissue type on Jun 15, 2025
  6. AndriySvyryd commented on Nov 15, 2026

    @AndriySvyryd
    Member

    This should also describe the equality guarantees of a type mapping, and make those guarantees available to query optimizations. A virtual capability on CoreTypeMapping is one possible design; the exact API and ownership need design discussion.

    The contract must distinguish:

    Agreement between server equality and client equality.
    The stronger guarantee needed for substitution: server-equal values cannot be distinguished by the operations across which the rewrite substitutes them.

    These are not equivalent. DateTimeOffset.Equals itself ignores the offset when comparing instants, while .Hour can distinguish those values. Existing Comparer, KeyComparer, and ProviderValueComparer APIs specify client-side comparisons; their presence or default implementation does not prove a server-side substitution is safe.

    Use the grouping-key aggregate lift as an initial consumer (‎HasIdentityEquality in NavigationExpandingExpressionVisitor.cs), with provider-specific coverage for safe mappings and rejected shapes. The goal is to enable safe optimizations, not to change normal database comparison semantics or implement general conversion-aware member translation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions