Show:

ↈ_relationArray_ Class

Relation arrays are not actually classes, they are objects that mimic arrays. A relation array is collection of entities associated with a navigation property on a single entity. i.e. customer.orders or order.orderDetails. This collection looks like an array in that the basic methods on arrays such as 'push', 'pop', 'shift', 'unshift', 'splice' are all provided as well as several special purpose methods.

Item Index

Methods

Events

Methods

load

(
  • [callback]
  • [errorCallback]
)
Promise

Performs an asynchronous load of all other the entities associated with this relationArray.

Parameters:

  • [callback] Function optional
  • [errorCallback] Function optional

Returns:

Example:

// assume orders is an empty, as yet unpopulated, relation array of orders
// associated with a specific customer.
orders.load().then(...)

Events

arrayChanged

An Event that fires whenever the contents of this array changed. This event is fired any time a new entity is attached or added to the EntityManager and happens to belong to this collection. Adds that occur as a result of query or import operations are batched so that all of the adds or removes to any individual collections are collected into a single notification event for each relation array.

Event Payload:

  • added Array of Entity

    An array of all of the entities added to this collection.

  • removed Array of Entity

    An array of all of the removed from this collection.

Example:

// assume order is an order entity attached to an EntityManager.
orders.arrayChanged.subscribe(
function (arrayChangedArgs) {
    var addedEntities = arrayChangedArgs.added;
    var removedEntities = arrayChanged.removed;
});