Skip to content

Relational: Consider generating "missing ordering" warning for FirstOrDefault with predicate #33997

@roji

Description

@roji

In relational, when Skip/Take are used without an OrderBy, we generate a "missing ordering" because results are non-deterministic. We do the same for FirstOrDefault/SingleOrDefault, but for some reason we specifically don't generate the warning if a predicate is provided, e.g. Where(b => b.Posts.FirstOrDefault(b => b.Id > 8)). Whether a predicate is provided or not doesn't have any bearing on the determinism of the resultset (unless it happens to filter by equality to the key etc.).

It's worth noting that FirstOrDefault with predicate can be rewritten to Where+FirstOrDefault without predicate; we generate a warning for the latter but not for the former although they are identical.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions