ActionAttribute class

Namespace: CodeEffects.Rule.Attributes
Assembly: CodeEffects.Rule.dll

If applied to a public method of the source object, marks that method as a rule action available for use in execution type rules. The method must return System.Void and be parameterless or have only parameters of source object type or any value type supported by Code Effects (qualified method). This attribute can also be applied to a qualified method of any other public class in order to be usable as a rule action. In this case the source object must be decorated with the ExternalActionAttribute which references this method by name and class type.

Syntax

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ActionAttribute : System.Attribute,
	CodeEffects.Rule.Attributes.IDescribableAttribute

Properties

  • Description Type: System.String

    Gets or sets the description of the rule action. Rule authors can see this description when they hover the mouse over the action element in the Rule Editor. The value of this property is ignored if RuleEditor.ShowDescriptionsOnMouseHover is set to False. It's not advisable to use this property in multilingual applications; instead use culture-specific custom Source XML documents. This property is optional.

  • DisplayName Type: System.String

    Gets or sets the display name of the action method in the Rule Editor. Use this property to "represent" rule actions if the action method name is not descriptive enough for non-technical rule authors, or if you need to use several overloads of the same method as different actions. It's not advisable to use this property in multilingual applications; instead use culture-specific custom Source XML documents. This property is optional. The default value is the name of the qualified method.

Notes

This attribute is optional. Its purpose is to provide the ability to set DisplayName for rule actions. Code Effects component will use any qualified method of the source object as an action whether it's decorated with the ActionAttribute or not. Code Effects component ignores any qualified methods decorated with the ExcludeFromEvaluationAttribute. If the ActionAttribute applied to a non-qualified method, an exception will be thrown. All non-qualified methods that are not decorated with ActionAttribute will be ignored.

Example

using CodeEffects.Rule.Attributes;

namespace TestLibrary
{
	[Source]
	public class Thing
	{
		public string Name { get; set; }

		[Action("Rename the Thing", "Gives a different name to the Thing")]
		public void Rename(string newName)
		{
			this.Name = newName;
		}
	}
}
Post your support requests on Stackoverflow.com. You can also post your comments and product feedback using the form at the bottom of this page.
Comments: 0
Name (optional):
Comment (URLs are allowed and must start with http:// or https://; all tags will be encoded):
Remaining character count: