简体   繁体   English

嵌套类型的Workflow Foundation 4参数

[英]A Workflow Foundation 4 argument of a nested type

One of the arguments to my workflow (xaml) is a nested type declared in a static class. 我的工作流程(xaml)的参数之一是在静态类中声明的嵌套类型。 Unfortunately, the "Browse for .NET type" dialog box does not show me this type irrespective of what I search for 不幸的是,无论我搜索什么,“浏览.NET类型”对话框都不会向我显示此类型。

full.namespace.containingstaticlass.typeIneed

or 要么

full.namespace.containingstaticlass+typeIneed

Since the dialog didn't work, I tried editing the xaml itself but couldn't figure out how to define the 由于对话框不起作用,我尝试编辑xaml本身,但无法弄清楚如何定义

Type="InArgument(xmlnamespacetomyassembly:???)"

Help!? 救命!?

Edit: It seems the Workflow Designer does not work with nested types at all, because an expression to cast an object to a nested type gave me this error. 编辑:似乎工作流设计器根本不使用嵌套类型,因为将对象转换为嵌套类型的表达式给了我这个错误。

在此处输入图片说明

At this point, any workarounds will be most welcome! 在这一点上,任何变通办法将是最欢迎的!

Added a simple sample that shows the problem. 添加了一个显示问题的简单示例

  1. There is no way to add a parameter (in the designer) of type NestedType.EssentialStruct 无法在设计器中添加NestedType.EssentialStruct类型的参数
  2. Even if you add an expression to cast Object to NestedType.EssentialStruct in the properties window against any InArgument, the designer will complain. 即使您添加了一个表达式以将Object转换为属性窗口中针对任何InArgument的NestedType.EssentialStruct,设计人员也会抱怨。

Posting the relevant sections also: 同时发布相关部分:

The nested type that needs to be used in the CodeActivity 在CodeActivity中需要使用的嵌套类型

public static class NestedTypes
{
    public struct EssentialStruct
    {
    }
}

A simple activity that uses the nested type as an InArgument and result 使用嵌套类型作为InArgument和结果的简单活动

public sealed class TestActivity : CodeActivity<NestedTypes.EssentialStruct>
{
    public InArgument<NestedTypes.EssentialStruct> Handle
    {
        get;
        set;
    }

    protected override NestedTypes.EssentialStruct Execute(CodeActivityContext context)
    {
        return context.GetValue(this.Handle);
    }
}

I can't post the XAML that produces the error because the designer doesn't save it, errors out just before saving it. 我不能发布产生错误的XAML,因为设计器没有保存它,而是在保存之前将错误输出了。

You need to use import on the workflow. 您需要在工作流程上使用导入。 It's a tab in the designer. 这是设计器中的选项卡。 It's next to variables and arguments. 它紧邻变量和参数。

Check that the referenced assembly is built in x86 (or Any CPU). 检查引用的程序集是否在x86(或任何CPU)中内置。 I had the same problem and it turned out that the referenced DLL was x64 which made it so the Visual Studio designer couldn't see it. 我遇到了同样的问题,结果发现所引用的DLL是x64,因此它使Visual Studio设计人员看不到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM