Table of Contents

Class MultiObjectQueryBase<TQuery, TInnerQuery, TObject>

Namespace
CMS.DataEngine
Assembly
CMS.DataEngine.dll

Base class for multiple objects query

public class MultiObjectQueryBase<TQuery, TInnerQuery, TObject> : MultiQueryBase<TQuery, TInnerQuery>, IMultiObjectQuery<TQuery, TInnerQuery, TObject>, IMultiQuery<TQuery, TInnerQuery>, IObjectQuery<TQuery, TObject>, IDataQuery<TQuery>, IDataQuerySettings<TQuery>, IWhereCondition<TQuery>, IQueryParameters<TQuery>, IMultiObjectQuery, IMultiQuery, IObjectQuery, IDataQuery, IDataQuerySettings, IWhereCondition, IQueryParameters, IQueryObjectWithValue, IQueryObject, ICMSQueryable<TObject>, ICMSQueryable where TQuery : MultiObjectQueryBase<TQuery, TInnerQuery, TObject>, new() where TInnerQuery : AbstractQueryObject, IObjectQuery<TInnerQuery, TObject>, new() where TObject : BaseInfo

Type Parameters

TQuery
TInnerQuery
TObject
Inheritance
object
MultiQueryBase<TQuery, TInnerQuery>
MultiObjectQueryBase<TQuery, TInnerQuery, TObject>
Implements
IMultiObjectQuery<TQuery, TInnerQuery, TObject>
IMultiQuery<TQuery, TInnerQuery>
IObjectQuery<TQuery, TObject>
IDataQuery<TQuery>
ICMSQueryable<TObject>
Derived
Inherited Members
Extension Methods

Properties

ElementType

Returns the element type.

public Type ElementType { get; }

Property Value

Type

Expression

Query expression

public Expression Expression { get; }

Property Value

Expression

IsOffline

Returns true if the given collection is offline (disconnected from the database)

public bool IsOffline { get; }

Property Value

bool

ObjectType

Returns the object type of the objects stored within the collection.

public virtual string ObjectType { get; set; }

Property Value

string

Provider

Query provider

public IQueryProvider Provider { get; }

Property Value

IQueryProvider

TypedResult

Typed result

public virtual InfoDataSet<TObject> TypedResult { get; }

Property Value

InfoDataSet<TObject>

UseObjectTypeCondition

If true, the query uses the object type condition.

public virtual bool UseObjectTypeCondition { get; set; }

Property Value

bool

Methods

ApplyProperties(IDataQuery, bool)

Applies main query properties to the given query to ensure synchronized state before execution

protected override void ApplyProperties(IDataQuery query, bool multiQuery = false)

Parameters

query IDataQuery

Query to prepare

multiQuery bool

If true, the query is an inner query within multi-query

AsNested()

Creates a nested query from the given query

public virtual ObjectQuery<TObject> AsNested()

Returns

ObjectQuery<TObject>

CreateChild(IDataQuerySettings)

Creates the child collection based on the given provider

public ICMSQueryable<TObject> CreateChild(IDataQuerySettings settings)

Parameters

settings IDataQuerySettings

Query parameters

Returns

ICMSQueryable<TObject>

CreateQuery(string)

Creates query for the given type

protected override TInnerQuery CreateQuery(string type)

Parameters

type string

Query type

Returns

TInnerQuery

GetEnumerableTypedResult(CommandBehavior, bool)

Gets enumerable collection of TObject representing the result of this query.

public virtual IEnumerable<TObject> GetEnumerableTypedResult(CommandBehavior commandBehavior = CommandBehavior.Default, bool newConnection = false)

Parameters

commandBehavior CommandBehavior

Command behavior for the underlying reader.

newConnection bool

If true, the underlying reader will be executed using its own dedicated connection.

Returns

IEnumerable<TObject>

Returns the enumeration resulting from query execution.

Exceptions

NotSupportedException

Thrown when the query does not support reader.

GetEnumerableTypedResultAsync(CommandBehavior, bool, CancellationToken?)

Asynchronously gets enumerable collection of TObject representing the result of this query.

public virtual Task<IEnumerable<TObject>> GetEnumerableTypedResultAsync(CommandBehavior commandBehavior = CommandBehavior.Default, bool newConnection = false, CancellationToken? cancellationToken = null)

Parameters

commandBehavior CommandBehavior

Command behavior for the underlying reader.

newConnection bool

If true, the underlying reader will be executed using its own dedicated connection.

cancellationToken CancellationToken?

The cancellation instruction.

Returns

Task<IEnumerable<TObject>>

Returns a task returning the enumeration resulting from query execution.

Exceptions

NotSupportedException

Thrown when the query does not support reader.

GetEnumerator()

Gets the typed enumerator

public virtual IEnumerator<TObject> GetEnumerator()

Returns

IEnumerator<TObject>

GetObjectType(bool)

Returns object type of objects returned by this query

protected string GetObjectType(bool throwException = true)

Parameters

throwException bool

Throws exception when object type cannot be obtained because multi query that doesn't represent a single query

Returns

string

Exceptions

NotSupportedException

When throwException is true and multi query that doesn't represent a single query.

InitTypedResult(InfoDataSet<TObject>)

Initializes the typed result

protected virtual void InitTypedResult(InfoDataSet<TObject> typedResult)

Parameters

typedResult InfoDataSet<TObject>

Result

ModifyAllInnerQueries(Action<TInnerQuery>)

Modifies all inner queries with the given parameters

protected TQuery ModifyAllInnerQueries(Action<TInnerQuery> p)

Parameters

p Action<TInnerQuery>

Parameters for inner queries

Returns

TQuery

ModifySingleInnerQuery(Action<TInnerQuery>)

Modifies single inner query with the given parameters. Operation is not supported if multi query doesn't represent a single query source

protected TQuery ModifySingleInnerQuery(Action<TInnerQuery> p)

Parameters

p Action<TInnerQuery>

Parameters for inner query

Returns

TQuery

NewDataSet()

Creates a new DataSet for the query results

protected override DataSet NewDataSet()

Returns

DataSet

WithCodeName(string)

Sets the where condition for a specific object code name

public virtual TQuery WithCodeName(string codeName)

Parameters

codeName string

Code name

Returns

TQuery

WithGuid(Guid)

Sets the where condition for a specific object GUID

public virtual TQuery WithGuid(Guid guid)

Parameters

guid Guid

Object GUID

Returns

TQuery

WithID(int)

Sets the where condition for a specific object ID

public virtual TQuery WithID(int objectId)

Parameters

objectId int

Object ID

Returns

TQuery

WithObjectType(string)

Changes the query to use the given object type. Applies the object type condition to the query. The new object type must have the same class name as the original one.

public virtual TQuery WithObjectType(string objectType)

Parameters

objectType string

Object type for the query

Returns

TQuery