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

Reducing SOQL's shared by services

Open konradbeck-creditech opened this issue 5 years ago • 3 comments
trafficstars

Is there a good way to reduce the number of queries when multiple service methods use the same selector?

konradbeck-creditech avatar Jul 10 '20 11:07 konradbeck-creditech

@konradbeck-creditech, I am not certain that I understand what you are asking. Can you elaborate and provide some examples please?

ImJohnMDaniel avatar Jul 12 '20 19:07 ImJohnMDaniel

@konradbeck-creditech from a design perspective this sounds like a compound service scenario - thus move the queries into the compound service and pass the data sets into the child service as arguments (overloaded methods if you have existing client/caller code using them directly).

afawcett avatar Jul 20 '20 18:07 afawcett

an ability to cache data in a Selector or Service would be convenient, although overuse might be evidence of an anti-pattern somewhere in the code.

SWhalen-gh avatar Sep 04 '20 16:09 SWhalen-gh