Show / Hide Table of Contents

    Class SqlBlockExtensions

    Sql block extensions

    Inheritance
    Object
    SqlBlockExtensions
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: XData.Database.SqlBlock
    Assembly: XData.docfx.dll
    Syntax
    public static class SqlBlockExtensions

    Methods

    | Improve this Doc View Source

    Case<T, TResult>(IBlockQueryAdapter, Expression<Func<IBlockQueryAdapter, T>>, Expression<Func<IBlockQueryAdapter, TResult>>, TaggedExpression<T, TResult>[])

    Case

    Declaration
    public static TResult Case<T, TResult>(this IBlockQueryAdapter adapter, Expression<Func<IBlockQueryAdapter, T>> expression, Expression<Func<IBlockQueryAdapter, TResult>> elseValue, params TaggedExpression<T, TResult>[] switchValues)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Source query structure adapter

    Expression<Func<IBlockQueryAdapter, T>> expression

    Case expression

    Expression<Func<IBlockQueryAdapter, TResult>> elseValue

    Else value

    TaggedExpression<T, TResult>[] switchValues

    Case switch values

    Returns
    Type Description
    TResult

    Case result

    Type Parameters
    Name Description
    T

    SQL case source data mapped type

    TResult

    SQL case result mapped type

    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    | Improve this Doc View Source

    DateDiff<T>(IBlockQueryAdapter, Expression<Func<IBlockQueryAdapter, DateTime>>, Expression<Func<IBlockQueryAdapter, DateTime>>, DateDiffKind)

    Dates difference

    Declaration
    public static T DateDiff<T>(this IBlockQueryAdapter adapter, Expression<Func<IBlockQueryAdapter, DateTime>> finalDate, Expression<Func<IBlockQueryAdapter, DateTime>> startDate, DateDiffKind kind)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Source query structure adapter

    Expression<Func<IBlockQueryAdapter, DateTime>> finalDate

    Final date

    Expression<Func<IBlockQueryAdapter, DateTime>> startDate

    Start date

    DateDiffKind kind

    Dates differences kind

    Returns
    Type Description
    T

    Dates difference

    Type Parameters
    Name Description
    T

    SQL function DateDiff result data mapped type

    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    | Improve this Doc View Source

    ExecuteSqlBlock(IDataScope, Expression<SqlBlockDefinition>, Expression<Func<ISqlParamAdapter, ISqlParam>>[])

    Execute SQL block

    Declaration
    public static QueryResult ExecuteSqlBlock(this IDataScope dataScope, Expression<SqlBlockDefinition> block, params Expression<Func<ISqlParamAdapter, ISqlParam>>[] parameters)
    Parameters
    Type Name Description
    IDataScope dataScope

    Data scope

    Expression<SqlBlockDefinition> block

    Sql block structure

    Expression<Func<ISqlParamAdapter, ISqlParam>>[] parameters

    Sql block parameters

    Returns
    Type Description
    QueryResult

    SQL block executed over database

    | Improve this Doc View Source

    Exists(IBlockQueryAdapter, String)

    Exists

    Declaration
    public static bool Exists(this IBlockQueryAdapter adapter, string subQueryAlias)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Source query structure adapter

    String subQueryAlias

    Subquery alias

    Returns
    Type Description
    Boolean
    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    | Improve this Doc View Source

    GetSqlBlockData<T>(IDataScope, Expression<SqlBlockDefinition<T>>, Expression<Func<ISqlParamAdapter, ISqlParam>>[])

    Select SQL block data

    Declaration
    public static IEnumerable<T> GetSqlBlockData<T>(this IDataScope dataScope, Expression<SqlBlockDefinition<T>> block, params Expression<Func<ISqlParamAdapter, ISqlParam>>[] parameters)
        where T : class, new()
    Parameters
    Type Name Description
    IDataScope dataScope

    Data scope layer

    Expression<SqlBlockDefinition<T>> block

    Sql block structure

    Expression<Func<ISqlParamAdapter, ISqlParam>>[] parameters

    Sql block parameters

    Returns
    Type Description
    IEnumerable<T>

    SQL block data selected and mapped

    Type Parameters
    Name Description
    T

    SQL block result mapped type

    | Improve this Doc View Source

    HasFlag<T>(IBlockQueryAdapter, Expression<Func<IBlockQueryAdapter, T>>, Expression<Func<IBlockQueryAdapter, T>>, Expression<Func<IBlockQueryAdapter, T>>, Expression<Func<IBlockQueryAdapter, T>>)

    Bit mask has flag

    Declaration
    public static T HasFlag<T>(this IBlockQueryAdapter adapter, Expression<Func<IBlockQueryAdapter, T>> expression, Expression<Func<IBlockQueryAdapter, T>> flagValue, Expression<Func<IBlockQueryAdapter, T>> trueValue, Expression<Func<IBlockQueryAdapter, T>> falseValue)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Source query structure adapter

    Expression<Func<IBlockQueryAdapter, T>> expression

    Expression to test

    Expression<Func<IBlockQueryAdapter, T>> flagValue

    Flag value

    Expression<Func<IBlockQueryAdapter, T>> trueValue

    Result if flag exists

    Expression<Func<IBlockQueryAdapter, T>> falseValue

    Result if flag not exists

    Returns
    Type Description
    T

    Bit mask has flag than trueValue else falseValue

    Type Parameters
    Name Description
    T

    SQL bitmask flag test result data mapped type

    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    | Improve this Doc View Source

    SetExpression<TTag, TResult>(TTag, Expression<Func<IBlockQueryAdapter, TResult>>)

    Set expression to tag

    Declaration
    public static TaggedExpression<TTag, TResult> SetExpression<TTag, TResult>(this TTag key, Expression<Func<IBlockQueryAdapter, TResult>> expression)
    Parameters
    Type Name Description
    TTag key

    Tag value

    Expression<Func<IBlockQueryAdapter, TResult>> expression

    Expression

    Returns
    Type Description
    TaggedExpression<TTag, TResult>

    Tagged expression

    Type Parameters
    Name Description
    TTag

    Tag type

    TResult

    Expression result

    | Improve this Doc View Source

    SqlExpr<TResult>(IBlockQueryAdapter, String, Expression<Func<IBlockQueryAdapter, TResult>>[])

    Plain SQL expression with XData LINQ expression placeholders

    Declaration
    public static TResult SqlExpr<TResult>(this IBlockQueryAdapter adapter, string format, params Expression<Func<IBlockQueryAdapter, TResult>>[] expressions)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Source query structure adapter

    String format

    SQL expression body in Format(String, Object[]) style

    Expression<Func<IBlockQueryAdapter, TResult>>[] expressions

    XData LINQ parameter expressions

    Returns
    Type Description
    TResult

    SQL expression result

    Type Parameters
    Name Description
    TResult

    SQL expression result mapped type

    Remarks

    WARNING! Plain SQL expressions can use specific SQL dialect features!

    Data mapping may be not compatible with other database engines!

    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    | Improve this Doc View Source

    SqlFn<TResult>(IBlockQueryAdapter, String, Expression<Func<IBlockQueryAdapter, Object>>[])

    SQL function call

    Declaration
    public static TResult SqlFn<TResult>(this IBlockQueryAdapter adapter, string name, params Expression<Func<IBlockQueryAdapter, object>>[] parameters)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Source query structure adapter

    String name

    SQL function full qualified name

    Expression<Func<IBlockQueryAdapter, Object>>[] parameters

    Function parameters descriptions

    Returns
    Type Description
    TResult

    Function call result

    Type Parameters
    Name Description
    TResult

    SQL function result mapped type

    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    | Improve this Doc View Source

    SqlParam<TResult>(IBlockQueryAdapter, String, DbType, Expression<Func<IProcedureParameterAdapter, IProcedureParameterFlag>>[])

    SQL parameter definition

    Declaration
    public static TResult SqlParam<TResult>(this IBlockQueryAdapter adapter, string binding, DbType type, params Expression<Func<IProcedureParameterAdapter, IProcedureParameterFlag>>[] attributes)
    Parameters
    Type Name Description
    IBlockQueryAdapter adapter

    Query structure adapter

    String binding

    Parameter data binding name

    DbType type

    Parameter database type

    Expression<Func<IProcedureParameterAdapter, IProcedureParameterFlag>>[] attributes

    Parameter mapping attributes

    Returns
    Type Description
    TResult

    Parameter

    Type Parameters
    Name Description
    TResult

    Parameter mapped type

    Exceptions
    Type Condition
    XDataRuntimeException

    Function accessible in XData LINQ expressions only

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX