- Optimise DML interactions with the database
- Provide transactional control
- Simplify complex code that often spends a good portion of its time managing bulkificaiton and ‘plumbing’ record relationships together.
In this blog I’m going to show you two approaches to creating a reasonably complex set of records on the platform, comparing the pros and cons of the traditional approach vs that using the Unit of Work approach.
Complex Data Creation and Relationships
Lets first look at a sample peace of code to create a bunch Opportunity records and related, Product, PricebookEntry and eventually OpportunityLine records. It designed to have a bit of a variable element to it, as such the number of lines per Opportunity and thus Products varies depending…
View original post 1,067 more words