DataAccessIntent Property

Version: Available or changed with runtime version 5.0.

Sets the data access intent of the page.

Applies to

  • Page
  • Report
  • Query

Property Value

Value Available or changed with Description
ReadOnly runtime version 5.0 Intent to access records, but not to modify them. Read-only pages are run against a replica of the database leading to improved performance, but preventing modifications to the database records.
ReadWrite runtime version 5.0 Intent to access and modify records.

Syntax

DataAccessIntent = ReadOnly|ReadWrite;

Remarks

Note

It only applies to pages of the type API. For such, The Editable property must be set to false.

For reports, API pages, and API queries, the Business Central server can use read-only database replicas on Azure SQL Database and SQL Server. If replicas are enabled, use this property to reduce the load on the primary database. Using ReadOnly might also improve performance when viewing objects. ReadOnly works as a hint for the server to route the connection to a secondary (read-only) replica, if one is available. When a workload is executed against the replica, insert/delete/modify operations aren't possible. If any of these operations are executed against the replica, an exception is thrown at runtime.

From the client, the property value can be overwritten by using page 9880 Database Access Intent List page.

When calling an API page or API query, the property value can be overwritten by specifying HTTP request header Data-Access-Intent.

Note

Setting the DataAccessIntent property to ReadOnly doesn't guarantee that your data access will be running on the secondary replica. It's merely stating that the code only requires read ability, so a read-only connection can be used.

For example, the property doesn't apply to queries running at arbitrary times during normal AL execution (that is, the server doesn't change to ReadOnly mode in the middle of a transaction). So for queries, the property only fully applies when they're exposed as an API/OData feed directly.

See Also

Using Read Scale-Out for Better Performance
Optimizing SQL Server Performance
Properties
Page Properties
InDataSet Property
Specifying Data Access Intent for REST API GET requests