CleanCode C# Libraries v0.9.23 API

SqlFilterBuilder.GetMatchPhrase Method 

Generates a standard SQL matching clause.

public string GetMatchPhrase(
   String fieldName,
   String value
);

Parameters

fieldName
The database field name.
value
A value to match.

Return Value

Approximation SQL predicate.

Remarks

This adds the percent mark (%) to the front and back of the value and generates a matching clause. Example: GetMatchPhrase("Type", "abc") yields [Type] LIKE '%abc%'. Contrast this with the form of GetPhrase which yields the same result: GetPhrase("Type", "%abc%") In the latter method call, we explicitly include the percent marks, enabling the generic phrase builder to recognize that it needs a matching clause. Also, with GetPhrase we may include a leading percent, a trailing percent, or both. GetMatchPhrase always adds both a leading and trailing percent.

See Also

SqlFilterBuilder Class | CleanCode.Data Namespace