locked
CRM Helper Classes RRS feed

  • Question

  • Hi,

    in our current project, we want to create several helper classes (e.g. for retrieving crm data) to simplify custom development (plugins, workflows, isv, cutom code).

    Is it true that we need to different  classes for retrieving entities? One that uses the ICRMService of the context (plugins) and one that creates a CRMService manually (for use in custom dev)??

    Thanks and regards
    Jan
    Tuesday, November 10, 2009 7:44 AM

Answers

  • Hi,

    yes. See this example (which is of course not complete)

    public class CrmServiceWrapper : ICrmService
    {
     private CrmService _service;
    
     public CrmServiceWrapper( CrmService service )
     {
       _service = service;
     }
    
     public Guid Create( BusinessEntity entity )
     {
       return _service.Create( entity );
     }
     ...
    }
    • Marked as answer by Jan Klode Tuesday, November 10, 2009 8:36 AM
    Tuesday, November 10, 2009 8:19 AM

All replies

  • Hi,

    you can create a custom wrapper, which wraps the CrmService class (either from WSDL or from the SDK) and returns it as ICrmService.
    You will loose the async methods of the CrmService class and a few other things if you do so, but (imho) nothing important.
    Tuesday, November 10, 2009 7:56 AM
  • Good Idea! If we want to implement the ICRMService Interface, we need to implment e.g. a retrieve method that makes a call to the crmservice. So after all, we just wrap the crm service calls with methods from ICRMService Interface. Is this true?

    Thanks!

    Jan
    Tuesday, November 10, 2009 8:15 AM
  • Hi,

    yes. See this example (which is of course not complete)

    public class CrmServiceWrapper : ICrmService
    {
     private CrmService _service;
    
     public CrmServiceWrapper( CrmService service )
     {
       _service = service;
     }
    
     public Guid Create( BusinessEntity entity )
     {
       return _service.Create( entity );
     }
     ...
    }
    • Marked as answer by Jan Klode Tuesday, November 10, 2009 8:36 AM
    Tuesday, November 10, 2009 8:19 AM
  • Thanks, thats it!
    Tuesday, November 10, 2009 8:36 AM