.NET 工作流自定义活动 - 自定义属性

发布于 2024-09-02 06:12:26 字数 174 浏览 2 评论 0原文

我正在尝试为我的工作流程之一设置自定义活动。

我可以轻松地为我的活动设置一个字符串属性,但是我想要一个自定义属性,它是对象列表。

更准确地说,我想构建一个自定义活动来执行存储过程。我必须有一个存储过程名称的属性和一个需要指定名称、类型和值的参数的属性。

关于如何做到这一点有什么想法吗?

I am trying to set up a custom activity for one of my workflows.

I can easily setup a String property for my activity however I would like to have a custom property which is a list of objects.

More precisely, I would like to build a custom activity to execute stored procedures. I have to have a property for the Stored proc name and a property for the parameters for which I need to specify the name, type and value.

Any ideas on how to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

椒妓 2024-09-09 06:12:26

当然,我已经这样做过几次了。我只是为我的属性使用通用列表类型:

    public static DependencyProperty FailureCodesProperty = DependencyProperty.Register( "FailureCodes", typeof( System.Collections.Generic.IList<System.Int32> ), typeof( ValidateResponseActivity ) );

    [DesignerSerializationVisibilityAttribute( DesignerSerializationVisibility.Visible )]
    [BrowsableAttribute( true )]
    [CategoryAttribute( "Misc" )]
    public IList<Int32> FailureCodes
    {
        get { return (IList<int>) GetValue( FailureCodesProperty ); }
        set { SetValue( FailureCodesProperty, value ); }
    }

    public static DependencyProperty SuccessCodesProperty = DependencyProperty.Register( "SuccessCodes", typeof( System.Collections.Generic.IList<System.Int32> ), typeof( ValidateResponseActivity ) );

    [DesignerSerializationVisibilityAttribute( DesignerSerializationVisibility.Visible )]
    [BrowsableAttribute( true )]
    [CategoryAttribute( "Misc" )]
    public IList<Int32> SuccessCodes
    {
        get { return (IList<int>) GetValue( SuccessCodesProperty ); }
        set { SetValue( SuccessCodesProperty, value ); }
    }

这是一个 int 值列表,但我确信您可以将其设为对象值列表。

Sure, I've done that a couple times. I just use a generic list type for my property:

    public static DependencyProperty FailureCodesProperty = DependencyProperty.Register( "FailureCodes", typeof( System.Collections.Generic.IList<System.Int32> ), typeof( ValidateResponseActivity ) );

    [DesignerSerializationVisibilityAttribute( DesignerSerializationVisibility.Visible )]
    [BrowsableAttribute( true )]
    [CategoryAttribute( "Misc" )]
    public IList<Int32> FailureCodes
    {
        get { return (IList<int>) GetValue( FailureCodesProperty ); }
        set { SetValue( FailureCodesProperty, value ); }
    }

    public static DependencyProperty SuccessCodesProperty = DependencyProperty.Register( "SuccessCodes", typeof( System.Collections.Generic.IList<System.Int32> ), typeof( ValidateResponseActivity ) );

    [DesignerSerializationVisibilityAttribute( DesignerSerializationVisibility.Visible )]
    [BrowsableAttribute( true )]
    [CategoryAttribute( "Misc" )]
    public IList<Int32> SuccessCodes
    {
        get { return (IList<int>) GetValue( SuccessCodesProperty ); }
        set { SetValue( SuccessCodesProperty, value ); }
    }

This is for a list of int values, but I'm sure you could make it be a list of object values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文