简体   繁体   中英

.NET Workflow Custom Activity - Custom Property

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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