I have several methods in a class that has the same logic but I can't see how to avoid the duplication? Each method internally calls another service but otherwise the logic before and after the internal service call are the same, see the code snippet below.
Any help appreciated!
Many thanks,
code
public List<Customer> GetCustomerDetail(int id)
{
_log.debug("xxx");
if(something)
{
_log.debug("yyy");
}
var results = _internalService.GetCustomer(id);
if(results == null)
{
_log.debug("no results");
}
return results;
}
public List<Customer> GetCompanyDetail(int id)
{
_log.debug("xxx");
if(something)
{
_log.debug("yyy");
}
var results = _internalService.GetCompany(id);
if(results == null)
{
_log.debug("no results");
}
return results;
}
...
Aucun commentaire:
Enregistrer un commentaire