Show Navigation
Next Topic »
ActionAttribute class
Namespace: CodeEffects.Rule.Attributes
IMPORTANT Generic methods with generic params cannot be used in Source XML as in-rule methods or rule actions. Use plain .Net class(es) if your source object declares generic methods.
If applied to a qualified public method of the source object, marks that method as a rule action available for use in execution type rules. To qualify, 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. 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 = true)]
public 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. Rule Editor will use any qualified method of the source object as a rule action whether it's decorated with the ActionAttribute or not. Rule Editor 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 questions on
Stackoverflow and become a part of our growing community
Comments:
0
|
|