Class SqlExpressionExtensions
String extension methods used specifically to translate into SQL
Inheritance
Namespace: Umbraco.Cms.Core.Persistence
Assembly: Umbraco.Core.dll
Syntax
public static class SqlExpressionExtensions
Methods
View SourceSqlContains(string, string, TextColumnType)
Indicates whether a string contains another string using culture-invariant comparison.
Declaration
public static bool SqlContains(this string str, string txt, TextColumnType columnType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | The string to search within. |
| string | txt | The string to find. |
| TextColumnType | columnType | The type of the text column. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Do not use outside of SQL expressions.
SqlEndsWith(string, string, TextColumnType)
Indicates whether a string ends with another string using culture-invariant comparison.
Declaration
public static bool SqlEndsWith(this string str, string txt, TextColumnType columnType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | The string to search within. |
| string | txt | The string to find at the end. |
| TextColumnType | columnType | The type of the text column. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Do not use outside of SQL expressions.
SqlEquals(string, string, TextColumnType)
Indicates whether two strings are equal using culture-invariant comparison.
Declaration
public static bool SqlEquals(this string str, string txt, TextColumnType columnType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | The first string to compare. |
| string | txt | The second string to compare. |
| TextColumnType | columnType | The type of the text column. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Do not use outside of SQL expressions.
SqlIn<T>(IEnumerable<T>, T)
Indicates whether a collection contains a specified item for use in SQL IN expressions.
Declaration
public static bool SqlIn<T>(this IEnumerable<T> collection, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | collection | The collection to check. |
| T | item | The item to locate. |
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| T | The type of elements in the collection. |
Remarks
Do not use outside of SQL expressions.
SqlNullableEquals<T>(T?, T?, T)
Indicates whether two nullable values are equal, substituting a fallback value for nulls.
Declaration
public static bool SqlNullableEquals<T>(this T? value, T? other, T fallbackValue) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| T? | value | The value to compare. |
| T? | other | The value to compare to. |
| T | fallbackValue | The value to use when any value is null. |
Returns
| Type | Description |
|---|---|
| bool |
Type Parameters
| Name | Description |
|---|---|
| T | The nullable type. |
Remarks
Do not use outside of Sql expressions.
SqlStartsWith(string?, string, TextColumnType)
Indicates whether a string starts with another string using culture-invariant comparison.
Declaration
public static bool SqlStartsWith(this string? str, string txt, TextColumnType columnType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | The string to search within. |
| string | txt | The string to find at the start. |
| TextColumnType | columnType | The type of the text column. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Do not use outside of SQL expressions.
SqlWildcard(string, string, TextColumnType)
Performs a wildcard match on a string, where % represents any sequence of characters.
Declaration
public static bool SqlWildcard(this string str, string txt, TextColumnType columnType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | The string to match against. |
| string | txt | The pattern containing % wildcards. |
| TextColumnType | columnType | The type of the text column. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Do not use outside of SQL expressions.