Show:

QueryOptions Class

Module: breeze

A QueryOptions instance is used to specify the 'options' under which a query will occur.

Methods

<ctor> QueryOptions

(
  • [config]
)

QueryOptions constructor

Parameters:

  • [config] Object optional
    • [fetchStrategy] FetchStrategy optional
    • [mergeStrategy] MergeStrategy optional
    • [includeDeleted] Boolean optional

      Whether query should return cached deleted entities (false by default)

Example:

var newQo = new QueryOptions( { mergeStrategy: MergeStrategy.OverwriteChanges });
// assume em1 is a preexisting EntityManager
em1.setProperties( { queryOptions: newQo });

Any QueryOptions property that is not defined will be defaulted from any QueryOptions defined at a higher level in the breeze hierarchy, i.e.

  • from query.queryOptions
  • to entityManager.queryOptions
  • to QueryOptions.defaultInstance;

setAsDefault

() chainable

Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance. The current instance is returned unchanged.

Example:

var newQo = new QueryOptions( { mergeStrategy: MergeStrategy.OverwriteChanges });
newQo.setAsDefault();

using

(
  • config
)
QueryOptions chainable

Returns a copy of this QueryOptions with the specified MergeStrategy, FetchStrategy, or 'includeDeleted' option applied.

Parameters:

Returns:

Example:

// Given an EntityManager instance, em
var queryOptions = em.queryOptions.using(MergeStrategy.PreserveChanges);

or

var queryOptions = em.queryOptions.using(FetchStrategy.FromLocalCache);

or

var queryOptions = em.queryOptions.using({ mergeStrategy: MergeStrategy.OverwriteChanges });

or

var queryOptions = em.queryOptions.using({
    includeDeleted: true,
    fetchStrategy:  FetchStrategy.FromLocalCache 
});

Properties

defaultInstance

QueryOptions static

The default value whenever QueryOptions are not specified.

fetchStrategy

FetchStrategy

A FetchStrategy readOnly

includeDeleted

Boolean

Whether to include cached deleted entities in a query result (false by default).

readOnly

mergeStrategy

MergeStrategy

A MergeStrategy readOnly