Description
A great description is in the documentation on the official website.
Configuring the adapters in the app
When generating the application ember-flexberry
file is created app/adapters/application.js
with the following contents:
import { Projection, Adapter } from 'ember-flexberry-data';
import config from '../config/environment';
export default Adapter.Odata.extend(Projection.AdapterMixin, {
host: config.APP.backendUrls.api,
});
This is the adapter for the application, which specifies the address OData
service.
If the model has not defined your own adapter, use the adapter application. To determine the adapter for a specific model, you must create an adapter with the same name as the model, it can be done with the command:
ember g adapter my-model
The result of this command will create a file app/adapters/my-model.js
with the following contents:
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
});
In order to change the address OData
service for this model, it is necessary to override the property host
, specifying the new address OData
service. For example, if the configuration of the second address OData
service specified in the property api2
, you get this:
import ApplicationAdapter from './application';
import config from '../config/environment';
export default ApplicationAdapter.extend({
host: config.APP.backendUrls.api2,
});