CrmSvcUtil 仅创建 OrganizationServiceContext 派生体(应为 CrmOrganizationServiceContext)
我以这种方式使用 CrmSvUtil:
crmsvcutil.exe /url:http://crm2011/MyTestOrg/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /namespace:Xrm /serviceContextName:XrmDataContext
输出包含数千个业务对象和这个上下文类:
[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9688.1533")]
public partial class XrmDataContext : Microsoft.Xrm.Sdk.Client.OrganizationServiceContext
但是查看示例(即 .\sdk\walkthroughs\portal\consoleappwalkthrough) 我清楚地可以看到应该派生上下文类来自 OrganizationServiceContext 的更强大的子类 -> CrmOrganizationServiceContext:
[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9688.583")]
public partial class XrmServiceContext : Microsoft.Xrm.Client.CrmOrganizationServiceContext
我绝对需要 CrmOrganizationServiceContext,因为只有这样我才有我需要的构造函数。那么我做错了什么或者我错过了哪个设置?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看该 SDK 示例的网络版本中给出的参数。他们将生成您正在寻找的课程。
Check out the parameters given @ the web version of that SDK sample. They will generate the class you're looking for.
使用早期绑定生成器,并选中“使用 Xrm 客户端”复选框。它将使用您期望的基类生成上下文。
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.