Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QueryOptions

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

Hierarchy

  • QueryOptions

Index

Constructors

constructor

  • QueryOptions constructor

    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;

    Parameters

    Returns QueryOptions

Properties

fetchStrategy

fetchStrategy: FetchStrategy

The FetchStrategy to use with any queries. Read Only

includeDeleted

includeDeleted: boolean

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

mergeStrategy

mergeStrategy: MergeStrategy

The MergeStrategy to use with any queries. Read Only

Static defaultInstance

defaultInstance: QueryOptions = new QueryOptions({fetchStrategy: FetchStrategy.FromServer,mergeStrategy: MergeStrategy.PreserveChanges,includeDeleted: false})

The default instance for use whenever QueryOptions are not specified.

Methods

setAsDefault

  • setAsDefault(): any
  • 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.

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

    Returns any

toJSON

  • toJSON(): Object

using

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

    // 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
    });
    

    Parameters

    Returns QueryOptions

    A new QueryOptions instance.

Static fromJSON

Static resolve

Generated using TypeDoc