Skip to content

breeze-client / DataServiceAdapter

Interface: DataServiceAdapter ​

Defined in: src/config/interface-registry.ts:106

Reshapes data moving between breeze and server

Extends ​

Properties ​

changeRequestInterceptor ​

changeRequestInterceptor: ChangeRequestInterceptorCtor

Defined in: src/config/interface-registry.ts:131

The constructor of the ChangeRequestInterceptor the adapter creates for each save, to let an application change each entity's save request and the finished array of requests without writing its own adapter. Defaults to a no-op interceptor.


checkForRecomposition? ​

optional checkForRecomposition?: (context) => void

Defined in: src/config/config.ts:96

Optional. Called each time any adapter is initialized after this one first was, with { interfaceName, instance, isDefault }, so that this adapter can pick up a new dependency. The data service adapters use it to re-resolve their ajax adapter when a new default ajax adapter is initialized.

Parameters ​

context ​

any

Returns ​

void

Inherited from ​

BaseAdapter.checkForRecomposition


jsonResultsAdapter ​

jsonResultsAdapter: JsonResultsAdapter

Defined in: src/config/interface-registry.ts:136

The JsonResultsAdapter used to read this adapter's query and save results, unless the DataService names one of its own.


name ​

name: string

Defined in: src/config/config.ts:84

The name the adapter is registered under, such as 'webApi' or 'backingStore'. Names are matched without regard to case. registerAdapter reads it from a throwaway instance and throws if it is empty.

Inherited from ​

BaseAdapter.name

Methods ​

executeQuery() ​

executeQuery(mappingContext): Promise<QueryResult<any>>

Defined in: src/config/interface-registry.ts:119

Sends the query in mappingContext to the server. Resolves with the raw results, the inline count if one was asked for, and the httpResponse; Breeze then merges the results into the cache through the JsonResultsAdapter.

Parameters ​

mappingContext ​

MappingContext

Returns ​

Promise<QueryResult<any>>


fetchMetadata() ​

fetchMetadata(metadataStore, dataService): Promise<any>

Defined in: src/config/interface-registry.ts:113

Fetches the metadata for a service and imports it into the MetadataStore. Called by MetadataStore.fetchMetadata, and before the first query to a service that has server metadata. Resolves with the raw metadata, or with a string saying why there is none (for example, that another request already fetched it). Rejects with the server error if the request fails.

Parameters ​

metadataStore ​

MetadataStore

dataService ​

DataService

Returns ​

Promise<any>


initialize() ​

initialize(): void

Defined in: src/config/config.ts:90

Called by Breeze each time the adapter is initialized: when it is first created, and again whenever it is initialized by name or registered again, for example by configureBreeze. Resolve anything the adapter depends on here, not in the constructor.

Returns ​

void

Inherited from ​

BaseAdapter.initialize


saveChanges() ​

saveChanges(saveContext, saveBundle): Promise<SaveResult>

Defined in: src/config/interface-registry.ts:125

Sends the entities in saveBundle to the server and resolves with the saved entities and any key mappings. Called by EntityManager.saveChanges. Rejects with the server error, including any per-entity errors, if the save fails.

Parameters ​

saveContext ​

SaveContext

saveBundle ​

SaveBundle

Returns ​

Promise<SaveResult>

Released under the MIT License.