Table of Contents

Class QueryExtensions

Namespace
CMS.DataEngine.Query
Assembly
CMS.DataEngine.dll

Extensions to easily convert values to queries

public static class QueryExtensions
Inheritance
object
QueryExtensions

Methods

AsColumn(string)

Converts string to a query column which can be used in a query

public static QueryColumn AsColumn(this string columnName)

Parameters

columnName string

Column name

Returns

QueryColumn

AsExpression(string)

Converts string to a query expression which can be used in a query

public static QueryExpression AsExpression(this string expression)

Parameters

expression string

Expression

Returns

QueryExpression

AsLiteral<T>(T)

Converts value to a literal value which can be used in a query

public static QueryExpression AsLiteral<T>(this T value)

Parameters

value T

Value to convert

Returns

QueryExpression

Type Parameters

T

AsValue<T>(T, bool)

Converts object to a query value which can be used as a query parameter

public static QueryValueExpression AsValue<T>(this T value, bool expand = false)

Parameters

value T

Value

expand bool

If true, the value expands as constant

Returns

QueryValueExpression

Type Parameters

T

EnsureDataSet<TInfo>(QueryDataParameters)

Ensures FillDataSet property for given TInfo.

public static void EnsureDataSet<TInfo>(this QueryDataParameters parameters) where TInfo : BaseInfo

Parameters

parameters QueryDataParameters

QueryDataParameters object

Type Parameters

TInfo

Info object type

GetCountAsync<TInfo>(ObjectQuery<TInfo>, CancellationToken?)

Asynchronously gets the number of items which returns given object query.

public static Task<int> GetCountAsync<TInfo>(this ObjectQuery<TInfo> objectQuery, CancellationToken? cancellationToken = null) where TInfo : BaseInfo

Parameters

objectQuery ObjectQuery<TInfo>

Object query

cancellationToken CancellationToken?

The cancellation instruction.

Returns

Task<int>

Number of items.

Type Parameters

TInfo

Info object type

GetCount<TInfo>(ObjectQuery<TInfo>)

Gets the number of items which returns given object query.

public static int GetCount<TInfo>(this ObjectQuery<TInfo> objectQuery) where TInfo : BaseInfo

Parameters

objectQuery ObjectQuery<TInfo>

Object query

Returns

int

Number of items.

Type Parameters

TInfo

Info object type