Skip to content

breeze-client / MergeStrategy

Class: MergeStrategy ​

Defined in: src/query/query-options.ts:9

MergeStrategy is an 'Enum' that determines how entities are merged into an EntityManager.

Extends ​

Constructors ​

Constructor ​

new MergeStrategy(propertiesObj?): MergeStrategy

Defined in: src/core/enum.ts:72

Creates a symbol, copying each property of propertiesObj onto it. Used to declare the symbols of an enum, as static members of its class; its name is set when the class calls BreezeEnum.resolveSymbols.

Parameters ​

propertiesObj? ​

Object

Returns ​

MergeStrategy

Inherited from ​

BreezeEnum.constructor

Properties ​

_$typeName ​

_$typeName: string

Defined in: src/core/enum.ts:60

Type of the enum; set in prototype of each enum

Inherited from ​

BreezeEnum._$typeName


name ​

name: string

Defined in: src/core/enum.ts:58

The name of this symbol

Inherited from ​

BreezeEnum.name


Disallowed ​

static Disallowed: MergeStrategy

Defined in: src/query/query-options.ts:37

Disallowed is used to throw an exception if there is an incoming entity with the same key as an entity already in the cache. Use this strategy when you want to be sure that the incoming entity is not already in cache. This is the default strategy for EntityManager.attachEntity.


OverwriteChanges ​

static OverwriteChanges: MergeStrategy

Defined in: src/query/query-options.ts:24

MergeStrategy.OverwriteChanges always updates the cached entity with incoming values even if the entity is in a changed state (added, modified, deleted). After the merge, the pending changes are lost. The new EntityState will be EntityState.Unchanged unless you’re importing entities in which case the new EntityState will be that of the imported entities.


PreserveChanges ​

static PreserveChanges: MergeStrategy

Defined in: src/query/query-options.ts:17

MergeStrategy.PreserveChanges updates the cached entity with the incoming values unless the cached entity is in a changed state (added, modified, deleted) in which case the incoming values are ignored. The updated cached entity’s EntityState will remain EntityState.Unchanged unless you’re importing entities in which case the new EntityState will be that of the imported entities.


SkipMerge ​

static SkipMerge: MergeStrategy

Defined in: src/query/query-options.ts:30

SkipMerge is used to ignore incoming values. Adds the incoming entity to the cache only if there is no cached entity with the same key. This is the fastest merge strategy but your existing cached data will remain “stale”.

Methods ​

toJSON() ​

toJSON(): object

Defined in: src/core/enum.ts:180

Return enum name and symbol name

Returns ​

_$typeName ​

_$typeName: any

The name of the enum, such as "EntityState".

name ​

name: string

The name of the symbol, such as "Added".

Inherited from ​

BreezeEnum.toJSON


toString() ​

toString(): string

Defined in: src/core/enum.ts:175

Returns the string name of this Enum

Returns ​

string

Inherited from ​

BreezeEnum.toString


contains() ​

static contains(sym): boolean

Defined in: src/core/enum.ts:154

Returns whether an Enum contains a specified symbol.

ts
let symbol = DayOfWeek.Friday;
if (DayOfWeek.contains(symbol)) {
    // do something
}

Parameters ​

sym ​

BreezeEnum

Object or symbol to test.

Returns ​

boolean

Whether this Enum contains the specified symbol.

Inherited from ​

BreezeEnum.contains


fromName() ​

static fromName(name): any

Defined in: src/core/enum.ts:113

Returns an Enum symbol given its name.

ts
let dayOfWeek = DayOfWeek.from("Thursday");
// nowdayOfWeek === DayOfWeek.Thursday

Parameters ​

name ​

string

Name for which an enum symbol should be returned.

Returns ​

any

The symbol that matches the name or 'undefined' if not found.

Inherited from ​

BreezeEnum.fromName


getNames() ​

static getNames(): string[]

Defined in: src/core/enum.ts:100

Returns the names of all of the symbols contained within this Enum.

ts
let symbols = DayOfWeek.getNames();

Returns ​

string[]

All of the names of the symbols contained within this Enum.

Inherited from ​

BreezeEnum.getNames


getSymbols() ​

static getSymbols<T>(this): InstanceType<T>[]

Defined in: src/core/enum.ts:86

Returns all of the symbols contained within this Enum.

ts
let symbols = DayOfWeek.getSymbols();

Type Parameters ​

T ​

T extends typeof BreezeEnum

Parameters ​

this ​

T

Returns ​

InstanceType<T>[]

All of the symbols contained within this Enum.

Inherited from ​

BreezeEnum.getSymbols


resolveSymbols() ​

static resolveSymbols(): object[]

Defined in: src/core/enum.ts:124

Seals this enum so that no more symbols may be added to it. This should only be called after all symbols have already been added to the Enum. This method also sets the 'name' property on each of the symbols.

ts
DayOfWeek.resolveSymbols();

Returns ​

Inherited from ​

BreezeEnum.resolveSymbols

Released under the MIT License.