Click or drag to resize

InitialValueScriptAttribute Class

Defines an attribute that will define an initial value script for a modeled table field that will get evaluated and assigned in the target use environment, e.g., Javascript.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    GSF.ComponentModel.DataAnnotationsInitialValueScriptAttribute

Namespace: GSF.ComponentModel.DataAnnotations
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax
[AttributeUsageAttribute(AttributeTargets.Property)]
public sealed class InitialValueScriptAttribute : Attribute
View Source

The InitialValueScriptAttribute type exposes the following members.

Constructors
 NameDescription
Public methodInitialValueScriptAttribute Creates a new InitialValueScriptAttribute/
Top
Properties
 NameDescription
Public propertyInitialValueScript Gets the initial value expression for a modeled table field.
Public propertyTypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute)
Top
Methods
 NameDescription
Public methodEqualsReturns a value that indicates whether this instance is equal to a specified object.
(Inherited from Attribute)
Public methodGetHashCodeReturns the hash code for this instance.
(Inherited from Attribute)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodIsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Inherited from Attribute)
Public methodMatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Inherited from Attribute)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks

Example to set initial value to 30 days from now using a Javascript expression: [InitialValueScript("(new Date()).addDays(30)")]

Note that the DefaultValueAttribute should be used to set any constant values for new modeled record instances and the DefaultValueExpressionAttribute should be used for applying any needed server-side run-time expression defaults, either of these will get assigned when using the NewRecord function. The InitialValueScriptAttribute is used to initialize the property value using an expression that gets evaluated in the target environment.

See Also