Web服务中的多个早期绑定文件 [英] Multiple Early Bound Files in Web Service

查看:51
本文介绍了Web服务中的多个早期绑定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有3个不同端点的WCF服务,这些端点需要使用不同的Dynamics CRM早期绑定类文件。我将它们放在单独的命名空间中,并删除了: [程序集:Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()] 我似乎无法弄清楚如何指定启用代理类型时要使用哪个早期绑定文件。我试图避免将每个早期绑定文件放在单独的项目中。这些文件共享一些相似的实体,但最重要的是,开发组织中不存在各个端点的唯一字段和实体(端点1的实体在端点2中不存在)。

I have a WCF service with 3 different endpoints that need to use different Dynamics CRM early bound class files. I have them in separate namespaces, and have removed: [assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()] I can't seem to figure out how to specify which early bound file to use to when enabling proxy types. I am trying to avoid having each early bound file in a separate project. The files share some similar entities, but most importantly there are unique fields and entities that do not exist in the development organizations for the respective endpoints (endpoint 1 has entities that do not exist in endpoint 2).

推荐答案

您需要在至少一个文件中定义ProxyTypesAssemblyAttribute。实际上,哪个文件无关紧要,因为它是程序集属性,而不是类属性。您需要确保您不要尝试为该组织中不存在的IOrganizationService调用使用类型。

You'll need to have the ProxyTypesAssemblyAttribute defined in at least one file. It doesn't matter what file actually, since it is an assembly attribute, not a class attribute. You'll need to make sure that you don't attempt to use a type for an IOrganizationService call, that doesn't exist in that org.

更新1

我对ProxyTypesAssemblyAttribute的工作方式的理解是错误的。显然,在同一程序集中具有相同的 Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute(string)属性的类不能超过一个(字符串值必须为独特)。

My understanding of the way the ProxyTypesAssemblyAttribute works was wrong. Apparently you can't have more than one class in the same assembly with the same Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute(string) attribute (The string value has to be unique).

您有两种可能的解决方案:

You have two possible solutions:


  1. 创建单独的程序集。

  2. 为两者使用相同的名称空间,但不要通过为每个CRM组织为每个实体创建一个类来重复类(这是 https://xrmearlyboundgenerator.codeplex.com/ 很有帮助)。两者中都存在的任何实体,您都必须

    • 手动合并任何差异(并且在调用它时,您必须知道什么是有效的,并且对于每个Org!无效的内容,即,如果Org 1的Contact实体具有ShirtSize字段,而Org 2没有,则无法填充该属性并尝试插入Org 2),

    • 使用一个组织中的文件,然后删除另一个组织。

  1. Create separate Assemblies.
  2. Use the same namespace for both but don't duplicate classes by creating a class per entity for each CRM Org (This is where the https://xrmearlyboundgenerator.codeplex.com/ becomes very helpful). Any entities that exist in both, you'll have to either
    • Manually merge any differences (And when you're calling it, you'll have to know what is valid and what isn't valid for each Org! i.e. If Org 1's Contact entity has a ShirtSize field and Org 2 doesn't, you can't populate that attribute and attempt to insert into Org 2),
    • Use the file from one Org, and delete the other.

第二种可能的解决方案将起作用,但我认为这不可行。

The second possible solution would work, but I don't think it's viable.

这篇关于Web服务中的多个早期绑定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆