SqlLike
Ecng.Data.Sql
Builds LIKE patterns from caller-supplied text. A pattern produced here matches its input literally, provided the predicate declares EscapeChar in an ESCAPE clause — the SQL-standard clause understood alike by SQL Server, PostgreSQL, SQLite and MySQL, which is what keeps the escaping free of dialect knowledge.
Propriedades
Metacharacters
public static ReadOnlySpan<char> Metacharacters { get; }
value = SqlLike.Metacharacters
The characters a LIKE pattern reads as instructions rather than as text, in the order they must be escaped.
Métodos
EscapeLike
public static string EscapeLike(string value)
result = SqlLike.EscapeLike(value)
Escapes the pattern metacharacters in so that LIKE matches it as plain text.
- value
- Text to be matched literally.
Retorna: The escaped text.
ToLikeContains
public static string ToLikeContains(string value)
result = SqlLike.ToLikeContains(value)
Builds a "contains" pattern matching literally anywhere in the compared column.
- value
- Text to be matched literally.
Retorna: The pattern.
Campos
EscapeChar
public const char EscapeChar
value = SqlLike.EscapeChar
Character declared by the ESCAPE clause of a LIKE predicate.