StringLikeVisitor

Ecng.Data.Sql

Emits a LIKE predicate anchored by wildcards around the needle. The needle is text the caller is searching for, not a pattern, so its metacharacters are neutralised and the predicate declares EscapeChar. The needle is only known once the statement runs — it is a bound parameter or another column — which is why the escaping is left to the database.

Inherits: MethodVisitor

Constructors

StringLikeVisitor
protected StringLikeVisitor(string name, bool wildcardBefore, bool wildcardAfter)
stringLikeVisitor = StringLikeVisitor(name, wildcardBefore, wildcardAfter)

Emits a LIKE predicate anchored by wildcards around the needle. The needle is text the caller is searching for, not a pattern, so its metacharacters are neutralised and the predicate declares EscapeChar. The needle is only known once the statement runs — it is a bound parameter or another column — which is why the escaping is left to the database.

name
Method name. Only the single-string overload is registered: the StringComparison overloads cannot be honoured by LIKE, and translating them as if the comparison were absent would silently answer a different question.
wildcardBefore
Match any text before the needle.
wildcardAfter
Match any text after the needle.