DataService Class
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).
Item Index
Methods
Methods
<ctor> DataService
-
config
DataService constructor
Parameters:
-
config
Object-
serviceName
StringThe name of the service.
-
[adapterName]
String optionalThe name of the dataServiceAdapter to be used with this service.
-
[hasServerMetadata]
Bool optionalWhether the server can provide metadata for this service.
-
[jsonResultsAdapter]
JsonResultsAdapter optionalThe JsonResultsAdapter used to process the results of any query against this service.
-
[useJsonp]
Boolean optionalWhether 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
});
using
-
config
Returns a copy of this DataService with the specified properties applied.
Parameters:
-
config
Configuration ObjectThe 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