The second part of the redb.Route expression language guide goes under the hood: how a condition string becomes a compiled delegate, how templates keep their types, and how a package gate rejects broken routes before deployment.
Key points
- Route expressions compile once into `Func<IExchange, object?>` delegates through System.Linq.Expressions, with no interpreted fallback.
- The parser rejects trailing tokens and half-parsed text, so `.Filter("header.a >")` throws `ExpressionCompilationException` at `Start()`.
- A dash in a bare expression is subtraction, so `header.Content-Type` errors and must be written `${header.Content-Type}`.
- `${header.a}` keeps its type: `SetHeader("n", Expr("${header.a}"))` stores the int 42, not the string.
- Format suffixes such as `${header.price:F2}` use invariant culture; custom patterns go through `format(...)` or `dateformat(...)`.
- `++` and `--` write back into the exchange as read-modify-write, and compiled delegates share a cache cleared by `ExpressionResolver.ClearAllCaches()`.
This summary was generated by the agent from the original post on Redbase Blog. The full text and all rights belong to its author and publisher. Go to original