Show:

DataService Class

Defined in: a40_dataService.js:7
Module: breeze

A DataService instance is used to encapsulate the details of a single 'service'; this includes a serviceName, a dataService adapterInstance, and whether the service has server side metadata.

You can construct an EntityManager with either a serviceName or a DataService instance, if you use a serviceName then a DataService is constructed for you. (It can also be set via the EntityManager.setProperties method).

The same applies to the MetadataStore.fetchMetadata method, i.e. it takes either a serviceName or a DataService instance.

Each metadataStore contains a list of DataServices, each accessible via its ‘serviceName’. ( see MetadataStore.getDataService and MetadataStore.addDataService). The ‘addDataService’ method is called internally anytime a MetadataStore.fetchMetadata call occurs with a new dataService ( or service name).

Methods

<ctor> DataService

(
  • config
)

DataService constructor

Parameters:

  • config Object
    • serviceName String

      The name of the service.

    • [adapterName] String optional

      The name of the dataServiceAdapter to be used with this service.

    • [uriBuilderName] String optional

      The name of the uriBuilder to be used with this service.

    • [hasServerMetadata] Bool optional

      Whether the server can provide metadata for this service.

    • [jsonResultsAdapter] JsonResultsAdapter optional

      The JsonResultsAdapter used to process the results of any query against this service.

    • [useJsonp] Boolean optional

      Whether to use JSONP when making a 'get' request against this service.

Example:

var dataService = new DataService({
    serviceName: altServiceName,
    hasServerMetadata: false
});

var metadataStore = new MetadataStore({
    namingConvention: NamingConvention.camelCase
});

return new EntityManager({
    dataService: dataService,
    metadataStore: metadataStore
});

qualifyUrl

(
  • suffix
)
A Url string

Returns a url for this dataService with the specified suffix. This method handles dataService names either with or without trailing '/'s.

Parameters:

  • suffix String

    The resulting url.

Returns:

A Url string:

using

(
  • config
)
DataService chainable

Returns a copy of this DataService with the specified properties applied.

Parameters:

  • config Configuration Object

    The object to apply to create a new DataService.

Returns:

Properties

adapterInstance

An instance of the "dataService" adapter interface

The "dataService" adapter implementation instance associated with this EntityManager.

readOnly

adapterName

String

The adapter name for the dataServiceAdapter to be used with this service.

readOnly

hasServerMetadata

Boolean

Whether the server can provide metadata for this service.

readOnly

jsonResultsAdapter

JsonResultsAdapter

The JsonResultsAdapter used to process the results of any query against this DataService.

readOnly

serviceName

String

The serviceName for this DataService.

readOnly

useJsonP

Boolean

Whether to use JSONP when performing a 'GET' request against this service.

readOnly