1. Stylelabs.M.Base.Querying

Class Query

Describes a query for entities.

Inheritance

object

QueryLoadingResource

Query

Inherited Members

QueryLoadingResource.LoadConfiguration

Namespace: StylelabsStylelabs.MStylelabs.M.BaseQuerying

Assembly: Stylelabs.M.Sdk.dll

Syntax

public class Query : QueryLoadingResource

Properties

Gets or sets if and how entities resulting entities should be loaded. By default, no entities will be loaded.

Declaration

public EntityLoadOptions EntityLoadOptions { get; set; }

Property Value

TypeDescription
EntityLoadOptions

Filter

Gets or sets the filter for the query.

Declaration

public QueryFilter Filter { get; set; }

Property Value

TypeDescription
QueryFilter

ScrollTime

Gets or sets if specified, the query will return as QueryResult.ScrollId , which can be used to walk through the set of results without having to use paging.

Declaration

public TimeSpan? ScrollTime { get; set; }

Property Value

TypeDescription
TimeSpan

Skip

Gets or sets the number of items to skip. If not specified, no items will be skipped.

Declaration

public int? Skip { get; set; }

Property Value

TypeDescription
int

Gets or sets how the results should be sorted.

Declaration

public IEnumerable<Sorting> Sorting { get; set; }

Property Value

TypeDescription
IEnumerable<>Sorting

Take

Gets or sets the number of items to take. If not specified, the underlying implementation will use a default value.

Declaration

public int? Take { get; set; }

Property Value

TypeDescription
int

Methods

CreateEntitiesQuery(Func<QueryableEntities, IQueryable>)

Creates a Query from a linq expression. The query has Query.EntityLoadOptions.LoadEntities set to True, loading the resulting entities.

Declaration

public static Query CreateEntitiesQuery(Func<QueryableEntities<IQueryableEntity>, IQueryable<IQueryableEntity>> query)

Parameters

TypeNameDescription
Func<, >QueryableEntitiesIQueryableEntityIQueryable`1IQueryableEntityqueryCreates the linq expression.

Returns

TypeDescription
QueryA Query created from the specified query.

CreateIdsQuery(Func<QueryableEntities, IQueryable>)

Creates a Query from a linq expression. Only returns the ids of the resulting entities.

Declaration

public static Query CreateIdsQuery(Func<QueryableEntities<IQueryableEntity>, IQueryable<IQueryableEntity>> query)

Parameters

TypeNameDescription
Func<, >QueryableEntitiesIQueryableEntityIQueryable`1IQueryableEntityqueryCreates the linq expression.

Returns

TypeDescription
QueryA Query created from the specified query.

CreateQuery(Func<QueryableEntities, IQueryable>)

Creates a Query from a linq expression. If no loading configuration was specified, it will fall back to Ids.

Declaration

public static Query CreateQuery(Func<QueryableEntities<IQueryableEntity>, IQueryable<IQueryableEntity>> query)

Parameters

TypeNameDescription
Func<, >QueryableEntitiesIQueryableEntityIQueryable`1IQueryableEntityqueryCreates the linq expression.

Returns

TypeDescription
QueryA Query created from the specified query.

Remarks

When using the SDK, this is the preferred way to create queries. The SDK will automatically set the correct loading configuration.

Extension Methods

QueryExtensions.Copy(Query)

QueryExtensions.MakeSureEntitiesAreLoaded(Query)

QueryExtensions.MakeSureOnlyIdsAreLoaded(Query)

QueryExtensions.Validate(Query)

If you have suggestions for improving this article, let us know!