Implementing the standard query logic

The previous Selector usage example required a cast of the list to be returned to a list of Race__c objects, which is not ideal. To improve this, you can easily add a new method to the class to provide a more specific version of the base class method, as follows:

public List<Race__c> selectById(Set<Id>raceIds){ 
  return (List<Race__c>) selectSObjectsById(raceIds); 
}

Therefore, the usage code now looks like this:

List<Race__c> races =  
  new RacesSelector().selectById(raceIds);  

By using a selector for querying races, the preceding code is much smaller and therefore easier to read by other developers. In the next section, we will discover what other standard features are provided by the fflib_SObjectSelector class.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.89.24