I have class that has many public method which perfrom differnet service operations.
Inorder to do service operation it need to create service Instance.
How do I avoid calling private method from each function?
code snippet.
public class EmployeeModel
{
private IOrganizationService _service = CRMConnect.CrmService();
private void CreateCrmServiceInstance()
{
if (_service == null){
_service = CRMConnect.CrmService();
}
}
public List RetrieveAllContacts()
{
CreateCrmServiceInstance();
// do something using _service
}
public List UpdateContactStatus()
{
CreateCrmServiceInstance();
// do something using _service
}
Amit GuptaPosted Feb 8, 2018, 12:04 AM
Sanjay SharmaPosted Feb 12, 2018, 4:59 AM