Skip to content

Support client evaluation when store evaluation is not appropriate #10265

@ajcvickers

Description

@ajcvickers

This has come up a lot with discussion of value conversions (#242) but is also an issue with the SQLite ADO.NET provider (e.g. #10249 and #10198) and will be an issue for Oracle since it has a limited number of column types just like SQLite.

Things to consider:

  • Developers may want:
    • The sort order to be as it would be if run in .NET on the client
    • The sort order to be as it would be in the server, understanding that this is different due to
      • Conversion of values or value format
      • Different semantics on the server (e.g. collation)
    • Any sort order as long as it is deterministic
      • Even if it is less common for developers to want this, EF still often needs this
  • Forcing sorting on the client can have a big perf impact
  • Anything done to change this by default would be a breaking change--especially important for SQLite cases
  • In some cases it is possible to change the conversions to be order-preserving, but this often results in unnatural data in the database
  • Even if it cannot be guaranteed that order will be preserved, it could be that ordering is preserved for the subset of values actually used--consider positive/negative number spaces when converting to strings or byte arrays.

Things we could do:

  • Warn when this may be an issue
  • Allow developers to pick type mappings/conversions that preserve order
    • Decide whether this is a must or a preference. That is, if EF can't ensure order is preserved, then either:
      • Continue with a warning and use non-order preserving mapping with store ordering
      • Continue with a warning, but force ordering to be done client side
      • Throw and require that the developer make an explicit choice of how to proceed by configuring differently
  • Allow developers to use client-side ordering. This could be
    • Opt-in for any ordering
    • Automatically opted in when EF can't guarantee that order is preserved, but with a way to opt-out

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions