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 Code Effects (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, 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 Code Effects component 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, 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
{
	// The source object contains no actions of its own
	// but references external action declared in the Helper class
	[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 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: