Search Results for

    Show / Hide Table of Contents

    Class TCQLExpression

    Static class producing TCQL expressions and queries.

    Inheritance
    System.Object
    TCQLExpression
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: TimeCockpit.Data.QueryLanguage.Syntax
    Assembly: TimeCockpit.Data.dll
    Syntax
    public static class TCQLExpression

    Fields

    VersionInfoOnly

    default version info only instance.

    Declaration
    public static readonly QueryOptions VersionInfoOnly
    Field Value
    Type Description
    QueryOptions

    Properties

    IncludeAll

    Gets the single include all (IncludeAll).

    Declaration
    public static EntitySourceIncludeRelation IncludeAll { get; }
    Property Value
    Type Description
    EntitySourceIncludeRelation

    Null

    Gets the null constant.

    Declaration
    public static NullConstant Null { get; }
    Property Value
    Type Description
    NullConstant

    Methods

    Aggregate(AggregationFunctionCallType, Expression)

    Creates a Aggregate function call.

    Declaration
    public static AggregationFunctionCall Aggregate(AggregationFunctionCallType aggregation, Expression expression)
    Parameters
    Type Name Description
    AggregationFunctionCallType aggregation

    The aggregation type.

    Expression expression

    The expression to aggregate.

    Returns
    Type Description
    AggregationFunctionCall

    Returns a new Aggregation Function call that can be used in a select new with.

    Average(Expression)

    Creates a Avg aggregation function call.

    Declaration
    public static AggregationFunctionCall Average(Expression expression)
    Parameters
    Type Name Description
    Expression expression

    The expression to average.

    Returns
    Type Description
    AggregationFunctionCall

    Returns a new Aggregation Function call that can be used in a select new with.

    Constant(Boolean)

    Shortcut method to True and False.

    Declaration
    public static BooleanConstant Constant(bool value)
    Parameters
    Type Name Description
    System.Boolean value

    The value of the constant.

    Returns
    Type Description
    BooleanConstant

    Returns True if value is true, False otherwise.

    Constant(Decimal)

    Creates a decimal constant.

    Declaration
    public static DecimalConstant Constant(decimal numericValue)
    Parameters
    Type Name Description
    System.Decimal numericValue

    The numeric value.

    Returns
    Type Description
    DecimalConstant

    Returns a new DecimalConstant.

    Constant(Guid)

    Creates a guid constant.

    Declaration
    public static GuidConstant Constant(Guid guid)
    Parameters
    Type Name Description
    System.Guid guid

    The value of the constant.

    Returns
    Type Description
    GuidConstant

    Returns a new GuidConstant.

    Constant(String)

    Creates a string constant.

    Declaration
    public static StringConstant Constant(string stringValue)
    Parameters
    Type Name Description
    System.String stringValue

    The value of the string constant.

    Returns
    Type Description
    StringConstant

    Returns a new StringConstant

    Count()

    Creates a count aggregation.

    Declaration
    public static AggregationFunctionCall Count()
    Returns
    Type Description
    AggregationFunctionCall

    Returns a new AggregatinoFunctionCall AST node representing a count.

    CountDistinct(Expression)

    Creates a CountDistinct aggregate function AST node.

    Declaration
    public static AggregationFunctionCall CountDistinct(Expression expression)
    Parameters
    Type Name Description
    Expression expression

    The expression to aggrgate.

    Returns
    Type Description
    AggregationFunctionCall

    Returns a new AggregationFunctionCall AST node describing the Max aggregation.

    DateConstant(DateTime)

    Creates a DateConstant.

    Declaration
    public static DateConstant DateConstant(DateTime date)
    Parameters
    Type Name Description
    System.DateTime date

    the date value of the constant.

    Returns
    Type Description
    DateConstant

    Returns a new DateConstant(DateTime).

    DateTimeConstant(DateTime)

    Creates a DateTimeConstant.

    Declaration
    public static DateTimeConstant DateTimeConstant(DateTime dateTime)
    Parameters
    Type Name Description
    System.DateTime dateTime

    The value of the constant.

    Returns
    Type Description
    DateTimeConstant

    Returns a new DateTimeConstant(DateTime).

    From(String, EntitySourceInclude[])

    Creates a table source with optinal include.

    Declaration
    public static EntitySource From(string entityName, params EntitySourceInclude[] includes)
    Parameters
    Type Name Description
    System.String entityName

    The entity name to select from.

    EntitySourceInclude[] includes

    The optional include sources.

    Returns
    Type Description
    EntitySource

    Returns a new EntitySource AST node.

    FromBackReference(String, String)

    Creates a QuerySource from a back reference.

    Declaration
    public static BackReferenceSource FromBackReference(string backReferenceName, string alias = null)
    Parameters
    Type Name Description
    System.String backReferenceName

    The name of the back reference to select from.

    System.String alias

    The alias (optional) to refer to.

    Returns
    Type Description
    BackReferenceSource

    Returns a new BackReferenceSource.

    FromBackReference(String[], String)

    Creates a QuerySource from a back reference.

    Declaration
    public static BackReferenceSource FromBackReference(string[] backReferencePath, string alias = null)
    Parameters
    Type Name Description
    System.String[] backReferencePath

    The path of the back reference.

    System.String alias

    The (optional) alias

    Returns
    Type Description
    BackReferenceSource

    Returns a new BackReferenceSource.

    FromDeadOf(String)

    Returns a new DeadOf AST Node / query source.

    Declaration
    public static DeadOfSource FromDeadOf(string entityName)
    Parameters
    Type Name Description
    System.String entityName

    The name of the entity whose dead to select.

    Returns
    Type Description
    DeadOfSource

    Returns a new dead of source.

    FunctionCall(String, Expression[])

    Creates a function call object.

    Declaration
    public static FunctionCall FunctionCall(string functionName, params Expression[] parameters)
    Parameters
    Type Name Description
    System.String functionName

    The name of the function to call.

    Expression[] parameters

    The parameter expressions to the function.

    Returns
    Type Description
    FunctionCall

    Returns a new instance of FunctionCall(String, Expression[]).

    IncludeConditional(String, Expression, String)

    Creates a conditional include.

    Declaration
    public static EntitySourceIncludeConditional IncludeConditional(string backReferenceName, Expression condition, string backReferenceAliasName = null)
    Parameters
    Type Name Description
    System.String backReferenceName

    The name of the backreference.

    Expression condition

    The filter condition.

    System.String backReferenceAliasName

    The alias name for the backreference.

    Returns
    Type Description
    EntitySourceIncludeConditional

    Returns a new EntitySourceIncludeConditional AST node.

    IncludeRelation(String)

    Creates a EntitySourceIncludeRelation

    Declaration
    public static EntitySourceIncludeRelation IncludeRelation(string relationName)
    Parameters
    Type Name Description
    System.String relationName

    The name of the relation to include.

    Returns
    Type Description
    EntitySourceIncludeRelation

    Returns a new EntitySourceIncludeRelation AST node.

    MakeBinary(BinaryOperator, Expression, Expression)

    Creates a binary expression combining the left hand and the right hand expression with the operator given.

    Declaration
    public static BinaryExpression MakeBinary(BinaryOperator op, Expression leftHand, Expression rightHand)
    Parameters
    Type Name Description
    BinaryOperator op

    The operator to use.

    Expression leftHand

    The left hand argument to the operator.

    Expression rightHand

    the right hand argument to the operator.

    Returns
    Type Description
    BinaryExpression

    Returns a new BinaryExpression.

    Max(Expression)

    Creates a Max aggregate function AST node.

    Declaration
    public static AggregationFunctionCall Max(Expression expression)
    Parameters
    Type Name Description
    Expression expression

    The expression to aggrgate.

    Returns
    Type Description
    AggregationFunctionCall

    Returns a new AggregationFunctionCall AST node describing the Max aggregation.

    Member(String, String)

    Creates a new member declaration for an identifier member.

    Declaration
    public static MemberDeclarationNamedIdentifier Member(string name, string identifier)
    Parameters
    Type Name Description
    System.String name

    The name of the new member.

    System.String identifier

    The identifier the member references.

    Returns
    Type Description
    MemberDeclarationNamedIdentifier

    Returns a new instance of the MemberDeclarationNamedIdentifier AST node.

    Member(String, Expression)

    Creates a member declaration for an expression member.

    Declaration
    public static MemberDeclarationNamedExpression Member(string name, Expression expression)
    Parameters
    Type Name Description
    System.String name

    The name of the new member.

    Expression expression

    The expression of the member.

    Returns
    Type Description
    MemberDeclarationNamedExpression

    Returns a new instance of a MemberDeclarationNamedExpression AST node.

    Member(MemberAccess)

    Creates a forwarded member declaration used in a select new with. E.g. In

    From X In Timesheet Select New With { X.BeginTime } 

    "X.BeginTime" refers to such a member declaration.

    Declaration
    public static MemberDeclarationForwarded Member(MemberAccess memberAccess)
    Parameters
    Type Name Description
    MemberAccess memberAccess

    The member access describing the forwarded property.

    Returns
    Type Description
    MemberDeclarationForwarded

    Returns a new MemberDeclarationForwarded AST Node.

    Min(Expression)

    Creates a Min aggregate function AST node.

    Declaration
    public static AggregationFunctionCall Min(Expression property)
    Parameters
    Type Name Description
    Expression property

    The property to aggrgate.

    Returns
    Type Description
    AggregationFunctionCall

    Returns a new AggregationFunctionCall AST node describing the Min aggregation.

    OrderBy(Expression, SortDirection)

    Creates a new Orderby expression.

    Declaration
    public static OrderByExpression OrderBy(Expression sortExpression, SortDirection sortOrder)
    Parameters
    Type Name Description
    Expression sortExpression

    The expression producing the property to sort by.

    SortDirection sortOrder

    The sort order, Ascending or Descending.

    Returns
    Type Description
    OrderByExpression

    Returns a new OrderByExpression.

    OrderBy(OrderByExpression, OrderByExpression[])

    Creates a new order by.

    Declaration
    public static OrderBy OrderBy(OrderByExpression firstExpression, params OrderByExpression[] additionalOrderBys)
    Parameters
    Type Name Description
    OrderByExpression firstExpression

    The first expression to order by.

    OrderByExpression[] additionalOrderBys

    The second expression to order by.

    Returns
    Type Description
    OrderBy

    Returns a new instance of the OrderBy node.

    Parameter(String)

    Creates a new instance of the Parameter(String) class. Note that the leading @ to parameter names is part of the grammar and therefore may not be part of the parameterName.

    Declaration
    public static Parameter Parameter(string parameterName)
    Parameters
    Type Name Description
    System.String parameterName

    The name of the parameter.

    Returns
    Type Description
    Parameter

    Returns a new instance of the Parameter(String) class.

    ParseExpression(String)

    Uses the existing AST to convert a tcql expression to a new expression representation.

    Declaration
    public static Expression ParseExpression(string expression)
    Parameters
    Type Name Description
    System.String expression

    The expression to parse.

    Returns
    Type Description
    Expression

    Returns the expression tree.

    ParseQuery(String)

    Uses the existing ast to convert a tcql query to an sytanx query representation.

    Declaration
    public static Query ParseQuery(string query)
    Parameters
    Type Name Description
    System.String query

    The query to parse.

    Returns
    Type Description
    Query

    Returns the Syntax Tree of the query.

    Property(String)

    Creates a new instance of the MemberAccess class.

    Declaration
    public static MemberAccess Property(string property)
    Parameters
    Type Name Description
    System.String property

    the name of the property.

    Returns
    Type Description
    MemberAccess

    Returns a new MemberAccess.

    Property(String[])

    Constructs a member access with the path elements as arguments.

    Declaration
    public static MemberAccess Property(params string[] propertyPath)
    Parameters
    Type Name Description
    System.String[] propertyPath

    the property path.

    Returns
    Type Description
    MemberAccess

    Returns a new MemberAccess.

    Query(String)

    Builds a simple select all from a table name query.

    Declaration
    public static Query Query(string entityName)
    Parameters
    Type Name Description
    System.String entityName

    The name of the entity / backrefernce to query from.

    Returns
    Type Description
    Query

    Returns the Query representing the query.

    Query(String, Expression)

    Creates a select query with a where condition and an implicit select alias. E.g.

    var query = TcqlExpression.Query(
        "User",
        TcqlExpression.MakeBinary(
            TcqlExpressionType.Equal,
            TcqlExpression.Property("FirstName"),
            TcqlExpression.Constant("Max")));

    produces

    From U In User Where U.FirstName = ‘Max’ Select U
    Declaration
    public static Query Query(string entityName, Expression whereCondition)
    Parameters
    Type Name Description
    System.String entityName

    The name of the entity / back reference to query.

    Expression whereCondition

    The where condition of the query.

    Returns
    Type Description
    Query

    Returns a new query.

    Query(String, QuerySource, Expression, OrderBy, Select, QueryOptions)

    Creates a query with aliasname, querysource, where condition, orderby, select statement and query options.

    Declaration
    public static Query Query(string aliasName, QuerySource source, Expression where, OrderBy orderBy, Select select, QueryOptions options = null)
    Parameters
    Type Name Description
    System.String aliasName

    The alias name.

    QuerySource source

    The query source.

    Expression where

    The query filter.

    OrderBy orderBy

    The orderby clause.

    Select select

    The select clause.

    QueryOptions options

    The options.

    Returns
    Type Description
    Query

    Returns a new query.

    Query(String, QuerySource, Expression, OrderBy, SkipAndTake, Select, QueryOptions)

    Creates a query with aliasname, querysource, where condition, orderby, select statement and query options.

    Declaration
    public static Query Query(string aliasName, QuerySource source, Expression where, OrderBy orderBy, SkipAndTake skipAndTake, Select select, QueryOptions options = null)
    Parameters
    Type Name Description
    System.String aliasName

    The alias name.

    QuerySource source

    The query source.

    Expression where

    The query filter.

    OrderBy orderBy

    The orderby clause.

    SkipAndTake skipAndTake

    The skip and take clause.

    Select select

    The select clause.

    QueryOptions options

    The options.

    Returns
    Type Description
    Query

    Returns a new query.

    Query(String, QuerySource, Select)

    Creates a new query with an alias, a query source and a select.

    Declaration
    public static Query Query(string alias, QuerySource source, Select select)
    Parameters
    Type Name Description
    System.String alias

    The alias that refers to the source.

    QuerySource source

    The source to select from.

    Select select

    The select arguments.

    Returns
    Type Description
    Query

    Returns a new query.

    Query(String, Select)

    Creates a new Query without a where condition, but a select list / select alias choice.

    Declaration
    public static Query Query(string entityName, Select select)
    Parameters
    Type Name Description
    System.String entityName

    The name of the entity to select.

    Select select

    The select clause.

    Returns
    Type Description
    Query

    Returns a new query.

    Query(QuerySource)

    Creates a select all from a entity source.

    Declaration
    public static Query Query(QuerySource source)
    Parameters
    Type Name Description
    QuerySource source

    The source of the query.

    Returns
    Type Description
    Query

    Returns the query returned by Query(String, QuerySource, Expression, OrderBy, Select, QueryOptions)

    Query(QuerySource, Expression, Select)

    Creates a query with a query source, a where condition and a select clause.

    Declaration
    public static Query Query(QuerySource source, Expression where, Select select)
    Parameters
    Type Name Description
    QuerySource source

    The query source.

    Expression where

    The where condition.

    Select select

    The select clause.

    Returns
    Type Description
    Query

    Returns the new query.

    Query(QuerySource, Select)

    Creates a new query without a where clause, select options or an alias.

    Declaration
    public static Query Query(QuerySource source, Select select)
    Parameters
    Type Name Description
    QuerySource source

    The source to select from.

    Select select

    The select clause.

    Returns
    Type Description
    Query

    Returns a new query.

    SelectAlias(String, Int32)

    Creates a select alias.

    Declaration
    public static SelectAlias SelectAlias(string aliasName = null, int top = -1)
    Parameters
    Type Name Description
    System.String aliasName

    The (optional) name of the alias to select.

    System.Int32 top

    the (optional) top count

    Returns
    Type Description
    SelectAlias

    Returns a new select alias.

    SelectNewWith(Int32, MemberDeclaration[])

    Creates a new SelectNewWith AST node.

    Declaration
    public static SelectNewWith SelectNewWith(int top, params MemberDeclaration[] members)
    Parameters
    Type Name Description
    System.Int32 top

    The top limit, use -1 to set to unlimited.

    MemberDeclaration[] members

    The members of the select new with list.

    Returns
    Type Description
    SelectNewWith

    Returns a new instance of the SelectNewWith AST node.

    SelectNewWith(String, MemberDeclaration[])

    creates a new SelectNewWith AST node with a specified type as in

    From T In Timesheet Select New Project With { .Title = "My New Project" }

    In this sample, the type would be set to "Project" and the member to a collection holding a single MemberDeclarationNamedExpression("Title", TCQLExpression.Constant("My New Project")).

    Declaration
    public static SelectNewWith SelectNewWith(string type, params MemberDeclaration[] members)
    Parameters
    Type Name Description
    System.String type

    The type of the entity.

    MemberDeclaration[] members

    The members that will be actually set.

    Returns
    Type Description
    SelectNewWith

    Returns a new instance of the SelectNewWith AST node.

    SelectNewWith(MemberDeclaration[])

    Creates a SelectNewWith AST node. Forwards to SelectNewWith(Int32, MemberDeclaration[]).

    Declaration
    public static SelectNewWith SelectNewWith(params MemberDeclaration[] members)
    Parameters
    Type Name Description
    MemberDeclaration[] members

    The members of the SelectNewWith.

    Returns
    Type Description
    SelectNewWith

    Returns the result of SelectNewWith(Int32, MemberDeclaration[]).

    Set(String, String)

    Creates a named set reference.

    Declaration
    public static NamedSetReference Set(string setName, string propertyName = null)
    Parameters
    Type Name Description
    System.String setName

    The name of the set to reference.

    System.String propertyName

    The name of the property.

    Returns
    Type Description
    NamedSetReference

    Returns the named set reference.

    Set(Expression[])

    Creats an explicit set expression.

    Declaration
    public static ExplicitSet Set(params Expression[] elementExpressions)
    Parameters
    Type Name Description
    Expression[] elementExpressions

    The expressions producing the elements.

    Returns
    Type Description
    ExplicitSet

    Returns a new Instance of the ExplicitSet.

    SkipAndTake(Int32, Int32)

    Creates a skip and take structure.

    Declaration
    public static SkipAndTake SkipAndTake(int skip, int take)
    Parameters
    Type Name Description
    System.Int32 skip

    The skip value.

    System.Int32 take

    the take value, -1 if unbound.

    Returns
    Type Description
    SkipAndTake

    Returns the SkipAndTake(Int32, Int32) instance.

    Sum(Expression)

    Creates a Sum aggregation function call.

    Declaration
    public static AggregationFunctionCall Sum(Expression expression)
    Parameters
    Type Name Description
    Expression expression

    The expression to sum.

    Returns
    Type Description
    AggregationFunctionCall

    Returns a new Aggregation Function call that can be used in a select new with.

    In This Article
    Back to top Copyright © 2020 software architects gmbh