Class SelectCondition
- Namespace
- CMS.DataEngine
- Assembly
- CMS.DataEngine.dll
Provides the selection where condition for ABC IN (1, 2, 3, 4, 5, ...) for very large number of items.
public class SelectCondition
- Inheritance
-
objectSelectCondition
- Extension Methods
Constructors
SelectCondition()
Constructor, prepares empty condition object.
public SelectCondition()
SelectCondition(QueryDataParameters)
Constructor, prepares empty condition object bound to specific query parameters.
public SelectCondition(QueryDataParameters parameters)
Parameters
parametersQueryDataParametersQuery parameters
Fields
ALL_INLINE
Constant for Inline limit property defining that all items should be processed inline
public const int ALL_INLINE = -1
Field Value
- int
ALL_TABLE_VALUED_PARAMETER
Constant for Inline limit property defining that all items should be processed as table-valued parameter.
public const int ALL_TABLE_VALUED_PARAMETER = 0
Field Value
- int
mGroupGUID
Group GUID for the temp table.
protected Guid mGroupGUID
Field Value
- Guid
mParameters
Query parameters.
protected QueryDataParameters mParameters
Field Value
mWhereCondition
Where condition.
protected string mWhereCondition
Field Value
- string
Properties
InlineLimit
Limit of the number of items for the inline evaluation.
If there are more items than this limit, the where condition is returned in format: ColumnName IN (SELECT * FROM @List)), where @List is of the following SQL user-defined table types: Type_CMS_IntegerTable, Type_CMS_BigIntTable, Type_CMS_StringTable, Type_CMS_GuidTable
Otherwise, inline format is used: ColumnName IN (Value1, Value2, ...)
If set to -1, inline format is always used.
public int InlineLimit { get; set; }
Property Value
- int
Remarks
The default value depends on CMSDefaultSQLInlineLimit setting, which has a default value of 1000.
IsEmpty
Returns true if the selection is empty.
public bool IsEmpty { get; }
Property Value
- bool
WhereCondition
Returns the resulting where condition.
public string WhereCondition { get; }
Property Value
- string
Methods
Dispose()
Disposes the object and removes the selection from the database if it was allocated in the temp table.
public void Dispose()
PrepareCondition<T>(string, ICollection<T>, bool)
Prepares the select condition for specific value types
public void PrepareCondition<T>(string columnName, ICollection<T> values, bool negation = false)
Parameters
columnNamestringColumn name
valuesICollection<T>Values for the IN expression
negationboolIndicates if the negation should be used in the condition (Column NOT IN (1, 2, 3 ...))
Type Parameters
TMethod will prepare the condition over int, long, StringItem or System.Guid.
Remarks
Null values are ignored.
Exceptions
- NotSupportedException
Thrown when unsupported value type is used.