Skip to main content

Practice ยท 2 of 3

Mini query provider

CHALLENGE
Difficulty: advanced+25 XP

Implement static string Translate(Expression<Func<int, bool>> predicate) that walks the tree and produces a pseudo-SQL WHERE clause: GreaterThanOrEqual โ†’ ">=", LessThan โ†’ "<", Equal โ†’ "=", AndAlso โ†’ "AND", OrElse โ†’ "OR", with the parameter rendered as "x" and constants as their value. Example: x >= 5 renders "x >= 5"; (x >= 5) AND (x < 100) renders "x >= 5 AND x < 100".

Back to lesson: Practice: Expression drills