如何 return EntityCollection 作为 Outparameter 自定义 activity

How to return EntityCollection as Outparameter custom activity

    [ReferenceTarget("contact")]
    public InOutArgument<EntityReference> PartyList{ get; set; }

如何 return/send 从自定义 CodeActivity 返回工作流步骤的 ActivityParty 或 EntityCollection 列表?

在我的 execute 方法中,当我 return 一个 EntityCollection 或一个 List 时,我得到一个类型转换错误。


根据以下回复 - 我想补充一些说明: 我怎样才能将任何 collection 传递回去,我看到列表是有限的 - 我正在寻找解决方法。由于 EntityReference 是 reference/pointer 类型

EntityCollection 不在 Input/Output 类型的自定义工作流活动的受支持列表中:MSDN

您通过在 WF 步骤中获取 EntityCollection 试图实现的目标,应该可以在 WF activity 本身内部实现。

您遇到转换错误,因为您的输出参数类型是 EntityReference。

您不能在通用 InOutArgument<T> 属性中使用类型 EntityCollection

支持的类型有:

  • 布尔值
  • 日期时间
  • 十进制
  • 双人间
  • 实体引用
  • Int32
  • 金钱
  • 选项设置值
  • 字符串

参见MSDN