OutputParameters 必须包含一个名为 'BusinessEntityCollection' 的 属性,类型为 Microsoft.Xrm.Sdk.EntityCollection,用于 SDK 消息 RetrieveMultiple
OutputParameters must contain a property called 'BusinessEntityCollection' of type Microsoft.Xrm.Sdk.EntityCollection for SDK message RetrieveMultiple
在为虚拟实体创建插件时,在 Microsoft.Xrm.Sdk 中尝试将 EntityCollection 解析为 PluginExecutionContext 失败并显示消息
错误
"message":"OutputParameters must contain a property called 'BusinessEntityCollection' of type Microsoft.Xrm.Sdk.EntityCollection for SDK message RetrieveMultiple",
代码类似于
string data = await GetData(localcontext);
var desrlzdData = JsonConvert.DeserializeObject<CustomEntity[]>(data);
EntityCollection collection = new EntityCollection();
foreach (var d in desrlzdData)
{
collection.Entities.Add(mapper(d));
}
// Add result to output parameters
localcontext.PluginExecutionContext.OutputParameters["BusinessEntityCollection"] = collection;
在此修改最后一次:
localcontext.PluginExecutionContext.OutputParameters["EntityCollection"] = collection;
问题出在异步代码上,我没有在其中一个地方等待。所以 BusinessEntityCollection 没有被填充,但错误消息有点误导。
在为虚拟实体创建插件时,在 Microsoft.Xrm.Sdk 中尝试将 EntityCollection 解析为 PluginExecutionContext 失败并显示消息
错误
"message":"OutputParameters must contain a property called 'BusinessEntityCollection' of type Microsoft.Xrm.Sdk.EntityCollection for SDK message RetrieveMultiple",
代码类似于
string data = await GetData(localcontext);
var desrlzdData = JsonConvert.DeserializeObject<CustomEntity[]>(data);
EntityCollection collection = new EntityCollection();
foreach (var d in desrlzdData)
{
collection.Entities.Add(mapper(d));
}
// Add result to output parameters
localcontext.PluginExecutionContext.OutputParameters["BusinessEntityCollection"] = collection;
在此修改最后一次:
localcontext.PluginExecutionContext.OutputParameters["EntityCollection"] = collection;
问题出在异步代码上,我没有在其中一个地方等待。所以 BusinessEntityCollection 没有被填充,但错误消息有点误导。