.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.
精彩评论