2015年CRM SDK:解串器没有映射到这个名字任何类型的知识 [英] CRM 2015 SDK : The deserializer has no knowledge of any type that maps to this name

查看:607
本文介绍了2015年CRM SDK:解串器没有映射到这个名字任何类型的知识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在与CRM 2015年工作的SDK。我只是试图更新在C#中使用该SDK的值。但因为某些原因,我揣摩,还有当我救我的背景麻烦。

I am currently working with CRM 2015 SDK. I am simply trying to update a value in C# with this SDK. But for some reasons that I try to figure out, there is a trouble when I save my context.

有是代码:

foreach (KeyValuePair<string, Account> account in dicAccount)
{
    //Calcul of url/login/date/key/customer values
    string generatedUrl = Utilities.GenerateURL(url, login, date, key, customer);
  account.Value.new_Link = generatedUrl;
  if (!context.IsAttached(account.Value))
   {
       context.Attach(account.Value);
   }
   context.UpdateObject(account.Value);

 }
 SaveChangesResultCollection results = context.SaveChanges(SaveChangesOptions.ContinueOnError);
  if (results != null)
  {
       foreach (SaveChangesResult result in results)
           {
              Type type = result.Request.GetType();
              bool hasError = result.Error != null;
              Entity entity = (Entity)result.Request.Parameters["Target"];
             if (type == typeof(UpdateRequest))
                {
                    if (hasError)
                       {
                          if (entity != null)
                             {
                                  log.Error(result.Error.Message); 
                             }
                        }
                   }

在我的动态的实体,我有这样的:

On my Dynamics entities, I have this :

[Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("new_link")]

public string new_Link
{
    get
    {
        return this.GetAttributeValue<string>("new_link");
    }
    set
    {
        this.OnPropertyChanging("new_link");
        this.SetAttributeValue("new_link", value);
        this.OnPropertyChanged("new_link");
    }
}



现在,我得到这个错误的LOGERROR印刷

Right now, I got this error printed by the LogError :

格式化抛出一个异常,而试图反序列化消息:没有尝试反序列化参数的 http://schemas.microsoft.com/xrm/2011/Contracts/Services:request 。该消息的InnerException是错误在第1行位置12271.元素的http:/ /schemas.datacontract.org/2004/07/System.Collections.Generic:value '包含映射到该名称的数据类型的 http://schemas.microsoft.com/xrm/7.1/Contracts:ConcurrencyBehavior 。解串器没有映射到这个名字任何类型的知识。考虑更改您的DataContractResolver方法ResolveName的实施进行名称返回一个非空值ConcurrencyBehavior'和命名空间的 http://schemas.microsoft.com/xrm/7.1/Contracts 。。请参阅的InnerException了解更多详情。

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:request. The InnerException message was 'Error in line 1 position 12271. Element 'http://schemas.datacontract.org/2004/07/System.Collections.Generic:value' contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/7.1/Contracts:ConcurrencyBehavior'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'ConcurrencyBehavior' and namespace 'http://schemas.microsoft.com/xrm/7.1/Contracts'.'. Please see InnerException for more details.

几searchs后,我发现2可能的原因:

After few searchs, I found 2 possible causes :


  1. 启用代理类型:事实是我的代码来做到这一点。所以这个不能帮我。

  1. Enable Proxy type : the fact is I have the code to do that. So this couldn't help me.

_serviceProxy.EnableProxyTypes();

SDK的版本:我看到了有关事实的SDK 7.0版本可能会导致此问题的一些答案。事实是,我使用的是7.1版,我也与最新的7.1.1试试。我用这个DLL的: Microsoft.Xrm.Client Microsoft.Xrm.Sdk 微软.Crm.Sdk.Proxy

Version of SDK : I saw some answers about the fact that the SDK version 7.0 can cause this problem. The fact is that I am using the version 7.1 and I also try with the latest 7.1.1. I use this DLL's : Microsoft.Xrm.Client, Microsoft.Xrm.Sdk, Microsoft.Crm.Sdk.Proxy

此元素的类型:我也尝试用基本字符串数据类型。还有serealization的问题。

Type of this element : I also try with a basic string as datatype. There is still problem of serealization.

这些想法没有解决我的问题,现在,我真的do'nt知道在哪里,我想看看为解决解决这个问题。

None of these ideas solve my problem and right now, I do'nt really know where I am suppose to look into to solve fix this problem.

推荐答案

不是100%是什么问题,但我会建议尝试以下,看它是否帮助。

Not 100% what the issue is but I would suggest trying the following to see if it helps.


  1. 重新生成代理,它可能是您的代理已过期的情况下这就是为什么解串器没有映射到这个名字任何类型的知识。

尝试使用刚刚后期绑定,看看是否作品,有助于缩小东西下来,如果没有在早期绑定代码的问题。例如:

Try using late bound just to see if that works, help to narrow things down if there is a problem in the early bound code. For example:

实体帐户=新的实体(账户);
account.Id =新的GUID();
帐户[new_link] =你的价值;
service.Update(账户);


  1. 破发点代码和看到正在更新哪些值的帐户对象,例如:确认其他属性不具有奇数值。

这篇关于2015年CRM SDK:解串器没有映射到这个名字任何类型的知识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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