Search Results for

    Show / Hide Table of Contents
    View Source

    Class SqlExpressionExtensions

    String extension methods used specifically to translate into SQL

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Persistence
    Assembly: Umbraco.Core.dll
    Syntax
    public static class SqlExpressionExtensions

    Methods

    View Source

    SqlContains(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

    true if the string contains the specified text; otherwise, false.

    Remarks

    Do not use outside of SQL expressions.

    View Source

    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

    true if the string ends with the specified text; otherwise, false.

    Remarks

    Do not use outside of SQL expressions.

    View Source

    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

    true if the strings are equal; otherwise, false.

    Remarks

    Do not use outside of SQL expressions.

    View Source

    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

    true if the item is found in the collection; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of elements in the collection.

    Remarks

    Do not use outside of SQL expressions.

    View Source

    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.

    View Source

    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

    true if the string starts with the specified text; otherwise, false.

    Remarks

    Do not use outside of SQL expressions.

    View Source

    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

    true if the string matches the pattern; otherwise, false.

    Remarks

    Do not use outside of SQL expressions.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX