Reputation: 3776
I'm using CrmSvUtil this way:
crmsvcutil.exe /url:http://crm2011/MyTestOrg/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /namespace:Xrm /serviceContextName:XrmDataContext
And the output contains thousands of business objects and this context class:
[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9688.1533")]
public partial class XrmDataContext : Microsoft.Xrm.Sdk.Client.OrganizationServiceContext
But looking at the samples (namely .\sdk\walkthroughs\portal\consoleappwalkthrough) I clearly can see there that the context class should be derived from a more mighty sub class of OrganizationServiceContext -> CrmOrganizationServiceContext:
[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9688.583")]
public partial class XrmServiceContext : Microsoft.Xrm.Client.CrmOrganizationServiceContext
I definitely need CrmOrganizationServiceContext because only then I have the constructors I need. So what I'm doing wrong or which setting did I miss?
Upvotes: 12
Views: 7332
Reputation: 18895
Use the Early Bound Generator, and select check the check box "Use Xrm Client". It'll generate the Context with the base class you're expecting.
Upvotes: 0
Reputation: 5352
Check out the parameters given @ the web version of that SDK sample. They will generate the class you're looking for.
CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm\Xrm.cs /url:http://Crm/Contoso/XRMServices/2011/Organization.svc /domain:CONTOSO /username:administrator /password:pass@word1 /namespace:Xrm /serviceContextName:XrmServiceContext
Upvotes: 14