Class CqlQueryExtensions
Inheritance
Inherited Members
Namespace: Dse.Data.Linq
Assembly: Dse.dll
Syntax
public static class CqlQueryExtensions
Methods
AllowFiltering<TSource>(CqlQuery<TSource>)
The ALLOW FILTERING option allows to explicitly allow queries that require filtering. Please note that a query using ALLOW FILTERING may thus have unpredictable performance (for the definition above), i.e. even a query that selects a handful of records may exhibit performance that depends on the total amount of data stored in the cluster.
Declaration
public static CqlQuery<TSource> AllowFiltering<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source |
Returns
Type | Description |
---|---|
CqlQuery<TSource> |
Type Parameters
Name | Description |
---|---|
TSource |
Count<TSource>(CqlQuery<TSource>)
Returns the number of rows matching the query.
To execute this CqlScalar use Execute()
method.
Declaration
public static CqlScalar<long> Count<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | The CqlQuery<TSource> to return the first element of. |
Returns
Type | Description |
---|---|
CqlScalar<System.Int64> | A single result: the number of rows matching the query. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
Delete<TSource>(CqlQuery<TSource>)
Returns a representation of a DELETE cql statement
Declaration
public static CqlDelete Delete<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source |
Returns
Type | Description |
---|---|
CqlDelete |
Type Parameters
Name | Description |
---|---|
TSource |
DeleteIf<TSource>(CqlQuery<TSource>, Expression<Func<TSource, Boolean>>)
Returns a representation of a DELETE ... IF ... cql statement, for Lightweight Transactions support
Declaration
public static CqlConditionalCommand<TSource> DeleteIf<TSource>(this CqlQuery<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | |
System.Linq.Expressions.Expression<System.Func<TSource, System.Boolean>> | predicate |
Returns
Type | Description |
---|---|
CqlConditionalCommand<TSource> |
Type Parameters
Name | Description |
---|---|
TSource |
First<TSource>(CqlQuery<TSource>)
Returns a CqlQuery which after execution will return the first element in a sequence.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuerySingleElement<TSource> First<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | The CqlQuery<TSource> to return the first element of. |
Returns
Type | Description |
---|---|
CqlQuerySingleElement<TSource> | a CqlQuery<TSource> which after execution will return first element in the sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
First<TSource>(Table<TSource>, Expression<Func<TSource, Boolean>>)
Returns a CqlQuery which after execution returns the first element in a sequence that satisfies a specified condition.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuerySingleElement<TSource> First<TSource>(this Table<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
Table<TSource> | source | The Table<TSource> to return the first element of. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Boolean>> | predicate | A function to test each element for a condition. |
Returns
Type | Description |
---|---|
CqlQuerySingleElement<TSource> | a CqlQuery<TSource> which after execution will return first element in the sequence that passes the test in the specified predicate function. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
FirstOrDefault<TSource>(CqlQuery<TSource>)
Returns a CqlQuery which after execution will return the first element of a sequence,
or a default value if the sequence contains no elements.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuerySingleElement<TSource> FirstOrDefault<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | The CqlQuery<TSource> to return the first element of. |
Returns
Type | Description |
---|---|
CqlQuerySingleElement<TSource> |
|
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
FirstOrDefault<TSource>(Table<TSource>, Expression<Func<TSource, Boolean>>)
Returns a CqlQuery which after execution will return the first element of the sequence that satisfies a condition
or a default value if no such element is found.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuerySingleElement<TSource> FirstOrDefault<TSource>(this Table<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
Table<TSource> | source | The Table<TSource> to return the first element of. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Boolean>> | predicate | A function to test each element for a condition. |
Returns
Type | Description |
---|---|
CqlQuerySingleElement<TSource> | a CqlQuery<TSource> which after execution will return |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
GroupBy<TKey, TSource>(CqlQuery<TSource>, Expression<Func<TSource, TKey>>)
Returns a CqlQuery which after execution returns grouped sequence of values based on a predicate.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuery<IGrouping<TKey, TSource>> GroupBy<TKey, TSource>(this CqlQuery<TSource> source, Expression<Func<TSource, TKey>> predicate)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | The CqlQuery<TSource> to filter. |
System.Linq.Expressions.Expression<System.Func<TSource, TKey>> | predicate | A function to test each element for a condition. |
Returns
Type | Description |
---|---|
CqlQuery<System.Linq.IGrouping<TKey, TSource>> | a CqlQuery<TSource> which after execution will return an IEnumerable<TSource> that contains elements from the input sequence that satisfy the condition. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the value returned by selector. |
TSource | The type of the elements of source. |
OrderBy<TSource, TKey>(CqlQuery<TSource>, Expression<Func<TSource, TKey>>)
Sorts the elements, which are returned from CqlQuery, in ascending order according to a key.
Declaration
public static CqlQuery<TSource> OrderBy<TSource, TKey>(this CqlQuery<TSource> source, Expression<Func<TSource, TKey>> keySelector)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | A sequence of values to order, returned from CqlQuery<TSource>. |
System.Linq.Expressions.Expression<System.Func<TSource, TKey>> | keySelector | A function to extract a key from an element. |
Returns
Type | Description |
---|---|
CqlQuery<TSource> | a CqlQuery<TSource> which after execution returns an IEnumerable<TSource> sorted in ascending manner according to a key. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
TKey | The type of the key returned by keySelector. |
OrderByDescending<TSource, TKey>(CqlQuery<TSource>, Expression<Func<TSource, TKey>>)
Sorts the elements, which are returned from CqlQuery, in ascending order according to a key.
Declaration
public static CqlQuery<TSource> OrderByDescending<TSource, TKey>(this CqlQuery<TSource> source, Expression<Func<TSource, TKey>> func)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | A sequence of values to order, returned from CqlQuery<TSource>. |
System.Linq.Expressions.Expression<System.Func<TSource, TKey>> | func | A function to extract a key from an element. |
Returns
Type | Description |
---|---|
CqlQuery<TSource> | a CqlQuery<TSource> which after execution returns an IEnumerable<TSource> sorted in descending manner according to a key. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
TKey | The type of the key returned by keySelector. |
Select<TSource, TResult>(CqlQuery<TSource>, Expression<Func<TSource, TResult>>)
Projects each element of a sequence into a new form.
Declaration
public static CqlQuery<TResult> Select<TSource, TResult>(this CqlQuery<TSource> source, Expression<Func<TSource, TResult>> selector)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | A CqlQuery<TSource> which after execution returns a sequence of values to invoke a transform function on. |
System.Linq.Expressions.Expression<System.Func<TSource, TResult>> | selector | A transform function to apply to each element. |
Returns
Type | Description |
---|---|
CqlQuery<TResult> | a CqlQuery<TSource> which after execution will return an IEnumerable<TSource> whose elements
are the result of invoking the transform function on each element of source.
To execute this CqlQuery use |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
TResult | The type of the value returned by selector. |
Select<TGroup, TSource, TResult>(CqlQuery<IGrouping<TGroup, TSource>>, Expression<Func<IGrouping<TGroup, TSource>, TResult>>)
Declaration
public static CqlQuery<TResult> Select<TGroup, TSource, TResult>(this CqlQuery<IGrouping<TGroup, TSource>> source, Expression<Func<IGrouping<TGroup, TSource>, TResult>> selector)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<System.Linq.IGrouping<TGroup, TSource>> | source | |
System.Linq.Expressions.Expression<System.Func<System.Linq.IGrouping<TGroup, TSource>, TResult>> | selector |
Returns
Type | Description |
---|---|
CqlQuery<TResult> |
Type Parameters
Name | Description |
---|---|
TGroup | |
TSource | |
TResult |
Take<TSource>(CqlQuery<TSource>, Int32)
Returns a CqlQuery which after execution will return IEnumerable<TSource>
with specified number of contiguous elements from the start of a sequence.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuery<TSource> Take<TSource>(this CqlQuery<TSource> source, int count)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | The CqlQuery<TSource> to return the first element of. |
System.Int32 | count | The number of elements to return. |
Returns
Type | Description |
---|---|
CqlQuery<TSource> | a CqlQuery<TSource> which after execution will return IEnumerable<TSource> with specified number of contiguous elements from the start of a sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
ThenBy<TSource, TKey>(CqlQuery<TSource>, Expression<Func<TSource, TKey>>)
Sorts the elements, which are returned from CqlQuery, in ascending order according to a key.
Declaration
public static CqlQuery<TSource> ThenBy<TSource, TKey>(this CqlQuery<TSource> source, Expression<Func<TSource, TKey>> func)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | |
System.Linq.Expressions.Expression<System.Func<TSource, TKey>> | func |
Returns
Type | Description |
---|---|
CqlQuery<TSource> |
Type Parameters
Name | Description |
---|---|
TSource | |
TKey |
ThenByDescending<TSource, TKey>(CqlQuery<TSource>, Expression<Func<TSource, TKey>>)
Sorts the elements, which are returned from CqlQuery, in descending order according to a key.
Declaration
public static CqlQuery<TSource> ThenByDescending<TSource, TKey>(this CqlQuery<TSource> source, Expression<Func<TSource, TKey>> func)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | |
System.Linq.Expressions.Expression<System.Func<TSource, TKey>> | func |
Returns
Type | Description |
---|---|
CqlQuery<TSource> |
Type Parameters
Name | Description |
---|---|
TSource | |
TKey |
Update<TSource>(CqlQuery<TSource>)
Returns a representation of a UPDATE cql statement
Declaration
public static CqlUpdate Update<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source |
Returns
Type | Description |
---|---|
CqlUpdate |
Type Parameters
Name | Description |
---|---|
TSource |
UpdateIf<TSource>(CqlQuery<TSource>, Expression<Func<TSource, Boolean>>)
Returns a representation of a UPDATE ... IF ... cql statement, for Lightweight Transactions support
Declaration
public static CqlConditionalCommand<TSource> UpdateIf<TSource>(this CqlQuery<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | |
System.Linq.Expressions.Expression<System.Func<TSource, System.Boolean>> | predicate |
Returns
Type | Description |
---|---|
CqlConditionalCommand<TSource> |
Type Parameters
Name | Description |
---|---|
TSource |
UpdateIfExists<TSource>(CqlQuery<TSource>)
Returns a representation of a UPDATE ... IF EXISTS cql statement, for Lightweight Transactions support.
Declaration
public static CqlConditionalCommand<TSource> UpdateIfExists<TSource>(this CqlQuery<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source |
Returns
Type | Description |
---|---|
CqlConditionalCommand<TSource> |
Type Parameters
Name | Description |
---|---|
TSource |
Where<TSource>(CqlQuery<TSource>, Expression<Func<TSource, Boolean>>)
Returns a CqlQuery which after execution returns filtered sequence of values based on a predicate.
To execute this CqlQuery use Execute()
method.
Declaration
public static CqlQuery<TSource> Where<TSource>(this CqlQuery<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
CqlQuery<TSource> | source | The CqlQuery<TSource> to filter. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Boolean>> | predicate | A function to test each element for a condition. |
Returns
Type | Description |
---|---|
CqlQuery<TSource> | a CqlQuery<TSource> which after execution will return an IEnumerable<TSource> that contains elements from the input sequence that satisfy the condition. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |