locked
Data Validation for Custom Solution & Early-Bound RRS feed

  • Question

  • I have a custom solution that will be deployed to different CRM 2011 servers/organizations both on premise and online. To validate fields I plan to use webservices in a pre-stage plugin. For the webservices I was planning to use early-bound. To generate the code there is the utility crmSvcUtil. However, it needs to know the crmserver, organization name, etc. But that information will vary for each deployment. So how do I get early-bound just for my solution so it is independent of the server/organization?
    Friday, November 18, 2011 7:19 AM

Answers

  • Hi,

    I think you only need to generate the generated class once, and you can use the one of the overload method to pass the organization service proxy.

    AWCServiceContext context = new AWCServiceContext(_serviceProxy);

     

    Also from the plugin Service Provider you can create context.

     var context = (Microsoft.Xrm.Sdk.IPluginExecutionContext)
                    serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));
    


    Also another point to remember with Plugin, you must include the generated class file in the plugin project, also another important point to remember you must regenerate the code every time when some one make any changes to the entities.

    If it is a solution that should work across different implementation then you should consider using late binding.

     

     


    Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Friday, November 18, 2011 8:36 AM

All replies

  • Hi,

    I think you only need to generate the generated class once, and you can use the one of the overload method to pass the organization service proxy.

    AWCServiceContext context = new AWCServiceContext(_serviceProxy);

     

    Also from the plugin Service Provider you can create context.

     var context = (Microsoft.Xrm.Sdk.IPluginExecutionContext)
                    serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));
    


    Also another point to remember with Plugin, you must include the generated class file in the plugin project, also another important point to remember you must regenerate the code every time when some one make any changes to the entities.

    If it is a solution that should work across different implementation then you should consider using late binding.

     

     


    Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Friday, November 18, 2011 8:36 AM
  • You could create a blank organization (i.e. OOB) and import your solution. So then it would only contain the custom entities that will be part of your solution and no others. Run the CrmSvcUtil.exe on this organization and it will create the classes for the OOB entities and your select custom entities and custom fields.

    Kind regards

    Kirsten

    Friday, November 18, 2011 12:55 PM