Class Adapter
publicAn adapter is an object that receives requests from a store and
translates them into the appropriate action to take against your
persistence layer. The persistence layer is usually an HTTP API but
may be anything, such as the browser's local storage. Typically the
adapter is not invoked directly instead its functionality is accessed
through the store
.
⚠️ CAUTION you likely want the docs for
Adapter as extending this abstract class is unnecessary.
Creating an Adapter
Create a new subclass of Adapter
in the app/adapters
folder:
import Adapter from '@ember-data/adapter';
export default Adapter.extend({
// ...your code here
});
Model-specific adapters can be created by putting your adapter
class in an app/adapters/
+ model-name
+ .js
file of the application.
import Adapter from '@ember-data/adapter';
export default Adapter.extend({
// ...Post-specific adapter code goes here
});
Adapter
is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
findRecord()
createRecord()
updateRecord()
deleteRecord()
findAll()
query()
To improve the network performance of your application, you can optimize your adapter by overriding these lower-level methods:
findMany()
For an example of the implementation, see RESTAdapter
, the
included REST adapter.
Methods
- createRecord
- deleteRecord
- findAll
- findMany
- findRecord
- generateIdForRecord
- groupRecordsForFindMany
- query
- queryRecord
- serialize
- shouldBackgroundReloadAll
- shouldBackgroundReloadRecord
- shouldReloadAll
- shouldReloadRecord
- updateRecord
Properties
Events
No documented items