|
ExternalActionAttribute class
Namespace: CodeEffects.Rule.Attributes
Assembly: CodeEffects.Rule.dll
If applied to a source object, references an external public method as a rule action. The method must return System.Void and be parameterless or have only parameters of source object type or any value type supported by Web Rule (qualified method).
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ExternalActionAttribute : System.Attribute,
CodeEffects.Rule.Attributes.IExternalAttribute
Properties
-
Assembly
Type: System.String
Gets or sets the full name of the assembly that declares the action method class. Can be obtained by executing Assembly.GetAssembly(SourceObjectType).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 Web Rule should use as a rule action. This is a required property.
-
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. 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;
}
}
}
|