ReturnAttribute class

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

If applied to the return type of a qualified in-rule method, marks it as a value element of the rule condition (value element). The qualified method must return any value type supported by Code Effects.

Syntax

[AttributeUsage(AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)]
public sealed class ReturnAttribute : System.Attribute

Notes

In the equation ...

... Age( Birth date ) is equal to [18] ...

... Age is an in-rule method, Birth date is a parameter, and [18] is a value element that can be customized with the ReturnAttribute (i.e. the return value of in-rule method). See the source object topic for details on in-rule methods and actions.

Properties

  • AllowCalculations Type: System.Bool

    Used only in return values of numeric type, and is ignored in values of other types. Gets or sets the value indicating whether the return value of the in-rule method should be allowed to be expressed as a calculation. If set to True, rule authors must select between input and calculation input types before assigning the value. This property is optional. The default value is True.

  • DataSourceName Type: System.String

    Used only in return values that represent declared .NET return values of System.Int type, and is ignored in return values of other types. Gets or sets the unique name of the Dynamic Menu Data Source declared by the SourceAttribute on the source object.

  • DateTimeFormat Type: System.String

    Used only in return values of date and time types, and is ignored in values of other types. Gets or sets the date or time format of the return value displayed in the Rule Editor. You can use standard .NET date and time formatting. This property is not used during rule evaluation. This property is optional. The default date value format is "MMM dd, yyyy", and the default time value format is "hh:mm tt".

  • Max Type: System.Int64

    Used only with numeric and string return values, and is ignored by values of other types. For numeric values, gets or sets the maximum numeric value that rule authors can enter manually. For string values, gets or sets the maximum length of the string that rule authors can type as the value. Used by Code Effects only in the UI; it's not used in rule evaluations. This property is optional.

  • Min Type: System.Int64

    Used only in return values of numeric type, and is ignored in values of other types. Gets or sets the minimum numeric value that rule authors can enter manually. Used by Code Effects only in the UI; it's not used in rule evaluations. This property is optional.

  • StringComparison Type: System.StringComparison

    Used only in return values of string types, and is ignored in values of other types. Gets or sets the string comparison option value that will be used to compare string values in rule conditions during evaluation. Can be used to set culture-specific comparison options, including case sensitivity. The default value is System.StringComparison.OrdinalIgnoreCase.

  • ValueInputType Type: CodeEffects.Rule.Common.ValueInputType

    Gets or sets the value indicating whether the return value can only be typed in manually, only accepts other fields as a value, or both. For example, consider the rule equation Get ID( LastName ) = [123]. The return value of the in-rule method Get ID is [123] which is a number that the rule author typed in. This is a value entered by the "user", i.e. it's of type ValueInputType.User. The same equation can be expressed as Get ID( FirstName ) = Admin ID. Since the Admin ID is a field, this value was selected by the rule author as a "field" item from the menu, i.e. it's of type ValueInputType.Fields. This property is optional. The default value is ValueInputType.All, which allows both User and Fields input types.

Example

using CodeEffects.Rule.Common;
using CodeEffects.Rule.Attributes;

namespace TestLibrary
{
	public class Person
	{
		[Field(DateTimeFormat = "MM/dd/yyyy", DisplayName = "Birthday")]
		public DateTime DOB { get; set; }

		[Method("Get Age in Years")]
		[return: Return(ValueInputType = ValueInputType.User, Min = 0, Max = 150)]
		public int GetAge()
		{
			return (DateTime.Now - this.DOB).Year;
		}
	}
}
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: