Skip to content

Entity Framework String gt lt gte lte #58

@cherrydev

Description

@cherrydev

If a querystring is parsed that contains < > <= >= operators on two strings, the expression parser passes it through unchanged, which results in an error. Underneath, in SQL, strings can be compared ordinally with these operators, but EntityFramework requires them to be expressed as:

operand1.CompareTo(operand2) < 0
operand1.CompareTo(operand2) > 0
operand1.CompareTo(operand2) <= 0
operand1.CompareTo(operand2) >= 0

Unfortunately I cannot figure out how to use Configuration to replace GreaterThanNode et all with custom versions that can create these expressions. Am I correct in saying that CustomNodeMappings can't replace existing node types in this sort of way?

In any case, making it an extension isn't really important because converting these operators to CompareTo for strings is probably always going to be more useful than the error that we'd get otherwise, even if the underlying provider doesn't always have direct support for CompareTo like EF does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions