fflib-apex-common icon indicating copy to clipboard operation
fflib-apex-common copied to clipboard

Accept fflib_ISObjectDomain instances for all methods that accept List<SObject>

Open sauloefo opened this issue 5 years ago • 0 comments
trafficstars

Hello guys,

During the use of fflib in my project, every time I have to register records in UnitOfWork I have to do something like this:

fflib_ISObjectDomain accounts = getAccounts();
unitOfWorkInstance.registerNew(accounts.getRecords());

And I'd like to do:

fflib_ISObjectDomain accounts = getAccounts();
unitOfWorkInstance.registerNew(accounts);

As I mentioned, I think all methods that receive a List<SObject> instance could have an overload accepting fflib_ISObjectDomain.

The new methods would use the current implementation:

public void registerNew(fflib_ISObjectDomain domain)
{
    registerNew(domain.getRecords());
}

Does it make sense for you? I'd be happy to contribute with this little improvement.

Cheers,

sauloefo avatar Dec 12 '19 11:12 sauloefo