Show Navigation
Next Topic »
ExternalActionAttribute 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 source object, references an external qualified public method as a rule action. 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.
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface,
AllowMultiple = true, Inherited = true)]
public class ExternalActionAttribute : System.Attribute,
CodeEffects.Rule.Attributes.IExternalAttribute,
CodeEffects.Rule.Attributes.ISortable
Properties
-
Assembly
Type: System.String
Gets or sets the full name of the assembly that declares the action method class, which can be obtained by executing Assembly.GetAssembly( className ).FullName. If the Type property is not set, this property is required.
-
Method
Type: System.String
Gets or sets the name of the action method declared outside of the source object that Rule Editor should use as a rule action. This is a required property.
-
SortOrder
Type: System.Int16
Gets or sets the sort order in which the rule action method is placed in action menu on Rule Area. This property is optional. Default value is 0.
-
Type
Type: System.Type
Gets or sets the type of the class that declares the external action method. If the Assembly and TypeName properties are not set, this property is required.
-
TypeName
Type: System.String
Gets or sets the full name of the type of the class that declares the external action method, which can be obtained by executing typeof( ClassName ).FullName. If the Type property is not set, this property is required.
Notes
This attribute is optional. Its purpose is to provide references to external methods that you would like to use as rule actions. An exception will be thrown if this attribute points to a non-qualified method. If the external method declares multiple overloads, decorate each overload that you would like to use as a rule action with the ActionAttribute and set its DisplayName property to a unique display name.
Example
using System;
using CodeEffects.Rule.Attributes;
namespace TestLibrary
{
[ExternalAction(typeof(Helper), "SetNewDate")]
public class Thing
{
public DateTime? Date { get; set; }
}
public class Helper
{
[Action("Set new date", "Sets the new value to the Thing's Date field")]
public void SetNewDate(Thing thing)
{
thing.Date = DateTime.Now;
}
}
}
Post your questions on
Stackoverflow and become a part of our growing community
Comments:
0
|
|