Newer Version Available
Lightning Data Service (Developer Preview)
At the simplest level, you can think of Lightning Data Service as the Lightning Components version of the Visualforce standard controller. While this statement is an over-simplification, it serves to illustrate a point. Whenever possible, your components should use Lightning Data Service to read and modify Salesforce data.
Data access with Lightning Data Service is usually simpler than the equivalent using a server-side Apex controller. Read-only access can be entirely declarative in your component’s markup. For code that modifies data, your component’s JavaScript controller is roughly the same amount of code, and you eliminate the Apex entirely. Additionally, all of your data access code is consolidated into your component, which significantly reduces complexity.
Lightning Data
Service provides other benefits aside from the code. It’s built on highly efficient local storage
that’s shared across all components that use it. Records loaded in Lightning Data
Service are cached and shared across
components.
Components accessing the same record see significant performance
improvements, because a record is only loaded once, no matter how many components are using
it. Shared records also improve user interface consistency. When one component updates a
record, any other components using it are notified, and in most cases refresh
automatically.