Unit Of Work

Estimated reading: 1 minute 4 views

Introduction

The Unit of Work class implements the common enterprise pattern intended to optimize the database access for each transaction. The main benefits are:

  • Reduction of the number of DML operations executed against the database. This is important because the Salesforce platform limits regarding DML operations.
  • Autoresolving parent-child relationships.
  • Ensure the transaction completeness, avoiding partial DML operations.

Instead of executing DML operations (insert, update, delete) at any time that its required, all the DML operations are added to a sort of queue that is processed at the end of the transaction, reducing drastically both the number of DML operations and the time spent in database operations.

Leave a Comment

       
Euphoria, forever till the end of times

Euphoria

Share this Doc

Unit Of Work

Or copy link

CONTENTS