在crm 2015中执行事务错误中的多个请求

Execute multiple requests in transaction error in crm 2015

我使用 CRM 2015 SDK(v7.1.2) 开发了一个应用程序。我想通过 ExecuteTransactionRequest 发送 2 个 crm 请求,但出现错误:

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 451. Element
 'http://schemas.microsoft.com/xrm/2011/Contracts/Services:request'
contains data from a type that maps to the name
 'http://schemas.microsoft.com/xrm/2011/Contracts:ExecuteTransactionRequest'.
 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
 'ExecuteTransactionRequest' and namespace
 'http://schemas.microsoft.com/xrm/2011/Contracts'.'

this is my applicaion's picture

我用过这个link:https://msdn.microsoft.com/en-us/library/mt634414.aspx

请帮帮我!!!

请参阅第 "Execute messages in a single database transaction" 部分: https://msdn.microsoft.com/en-us/library/gg328075(v=crm.7).aspx

您发现此消息在您的客户端SDK 中,但这并不意味着它也在服务器上。您有 SDK 7.1,但在服务器上您有 7.0 - 转到您的 CRm 安装目录(可能是 C:\Program Files\Microsoft Dynamics CRM),转到 Server/bin 并检查 Microsoft.Xrm.Sdk.dll 的版本。它将类似于 7.0.1,并且不包含此消息。 我同意 MS 在线文档具有误导性,因为它显示了 CRM 2015 的这条消息,但不幸的是它在那里不可用。 至于交易,您可以像我们在 CRM 2015 更新 1 之前所做的那样 - 通过使用 CRM 命令模式。创建一个实体(称之为 Command 或其他名称)并制作一个 运行s on Create 的插件(例如,可以有很多方法,但这是最简单的)。

你在第 20 阶段和第 40 阶段在插件中所做的一切都将在事务中 运行,因此你可以将此逻辑放入此插件中。当然这个 "Command" 实体可以有一些你传入的参数,所以你可以为传递给该实体的不同参数使用不同的逻辑。希望你清楚。这不像 ExecuteTransaction 那样优雅,但它的工作非常好,它必须像许多版本的 CRM 那样完成,所以我确信它有效。