Table of Contents

Class QueryColumnList

Namespace
CMS.DataEngine
Assembly
CMS.DataEngine.dll

Represents a list of query columns

public class QueryColumnList : QueryColumnListBase
Inheritance
object
QueryColumnList
Inherited Members
Extension Methods

Constructors

QueryColumnList(IQueryObject)

Constructor

public QueryColumnList(IQueryObject parent = null)

Parameters

parent IQueryObject

Parent query parameters

QueryColumnList(string)

Creates an empty column list built from the given columns

public QueryColumnList(string columns)

Parameters

columns string

List of columns

Methods

Add(IQueryColumn)

Adds column into list, regardless of existing columns.

public void Add(IQueryColumn queryColumn)

Parameters

queryColumn IQueryColumn

Query column

Add(string)

Adds one QueryColumn into list, regardless of existing columns. QueryColumn added to the list is created via FromExpression(string).

public void Add(string column)

Parameters

column string

String representation of column

Examples

"A, B, C" will result in exception

"A as B", "A" or "5 as B" are accepted

Exceptions

ArgumentException

Only one column should be passed as argument

AddRange(IEnumerable<IQueryColumn>)

Adds columns into list, regardless of existing columns.

public void AddRange(IEnumerable<IQueryColumn> queryColumns)

Parameters

queryColumns IEnumerable<IQueryColumn>

Query columns

AddRangeUnique(QueryColumnList, bool)

Adds the given list of query columns, if not already present in the list.

public void AddRangeUnique(QueryColumnList columns, bool ignoreAllColumnsSelector = true)

Parameters

columns QueryColumnList

Columns to be added

ignoreAllColumnsSelector bool

Indicates whether column will be added if all columns selector is present in the list. If the list is empty, NoColumns is false and ignoreAllColumnsSelector is true, all columns selector is added.

AddRangeUnique(IEnumerable<IQueryColumn>, bool)

Adds the given enumerable of query columns, if not already present in the list.

public void AddRangeUnique(IEnumerable<IQueryColumn> columns, bool ignoreAllColumnsSelector = true)

Parameters

columns IEnumerable<IQueryColumn>

Columns to be added

ignoreAllColumnsSelector bool

Indicates whether column will be added if all columns selector is present in the list. If the list is empty, NoColumns is false and ignoreAllColumnsSelector is true, all columns selector is added.

AddRangeUnique(IEnumerable<string>, bool)

Adds columns that are not present in the list.

public void AddRangeUnique(IEnumerable<string> columns, bool ignoreAllColumnsSelector = true)

Parameters

columns IEnumerable<string>

Columns to be added

ignoreAllColumnsSelector bool

Indicates whether column will be added if all columns selector is present in the list. If the list is empty, NoColumns is false and ignoreAllColumnsSelector is true, all columns selector is added.

Remarks

Query columns to add are created from string columns via FromExpression(string). Adds only IQueryColumn columns which names are not already present.

AddUnique(IQueryColumn, bool)

Adds the given column to the column list, if column is not already present.

public void AddUnique(IQueryColumn column, bool ignoreAllColumnsSelector = true)

Parameters

column IQueryColumn

Column

ignoreAllColumnsSelector bool

Indicates whether column will be added if all columns selector is present in the list If the list is empty, NoColumns is false and ignoreAllColumnsSelector is true, all columns selector is added.

AsAliases()

Returns the column list transformed to the aliases of the columns.

public QueryColumnList AsAliases()

Returns

QueryColumnList

EnsureOrderByColumns(ref string)

Ensures that the order by columns are provided within the list of columns as aliases, modifies the order by expression to the aliases of those columns.

public void EnsureOrderByColumns(ref string orderBy)

Parameters

orderBy string

Order by expression

Load(IEnumerable<IQueryColumn>)

Loads the given list of columns to the list.

public void Load(IEnumerable<IQueryColumn> columns)

Parameters

columns IEnumerable<IQueryColumn>

Enumeration of columns

Examples

var queryColumnListInstance = new QueryColumnList();
var columns = new List<IQueryColumn>() { new QueryColumn("ColumnA"), new QueryColumn("ColumnB") })
queryColumnListInstance.Load(columns);

Load(string)

Loads the given columns to the list.

public void Load(string columns)

Parameters

columns string

Lists of columns separated by commas

Load(params string[])

Loads the given list of columns to the list.

public void Load(params string[] columns)

Parameters

columns string[]

Array of columns

Examples

var queryColumnListInstance = new QueryColumnList();
queryColumnListInstance.Load(new[] {"ColumnA", "ColumnB", "ColumnC"})