Skip to content

Performing DML Operations

Jason Siders edited this page Jul 4, 2025 · 15 revisions

Performing DML using apex-database-layer is simple!

DatabaseLayer.Dml wraps the standard Database class, and has 1:1 parity with its DML methods.

To leverage the framework, simply use the DatabaseLayer.Dml equivalent of any Database DML method. In most cases, this means prefixing each method with "do" - since insert, update, etc. are reserved keywords in apex:

// Don't use these standard Database methods or DML keywords:
insert account;
Database.insert(account);
Database.insert(account, false);
Database.insert(account, false, System.AccessLevel.SYSTEM_MODE);
// Use the DatabaseLayer.Dml equivalent:
DatabaseLayer.Dml.doInsert(account);
DatabaseLayer.Dml.doInsert(account, false);
DatabaseLayer.Dml.doInsert(account, false, System.AccessLevel.SYSTEM_MODE);

Why?

We recommend using DatabaseLayer.Dml instead of Database methods or standard DML keywords across your entire codebase. This practice has the following benefits:

Clone this wiki locally