Class DefaultValueOnNewAttribute
Indicates this property has a default value that should be initialized whenever a new instance of this item is created
This can be a hard coded value, or a formula that is evaluated at run time
Inheritance
Inherited Members
Namespace: LemonEdge.API.Attributes
Assembly: LemonEdge.API.dll
Syntax
public abstract class DefaultValueOnNewAttribute : Attribute
Constructors
DefaultValueOnNewAttribute()
Declaration
protected DefaultValueOnNewAttribute()
Fields
_defaultValue
Declaration
protected string _defaultValue
Field Value
Type | Description |
---|---|
string |
Methods
GetDefaultValue(Type, string)
Declaration
public abstract object GetDefaultValue(Type entityType, string propNameToDefault)
Parameters
Type | Name | Description |
---|---|---|
Type | entityType | |
string | propNameToDefault |
Returns
Type | Description |
---|---|
object |
SetValue(string)
Indicates this property should always have the specified value when a new Entity is created
Declaration
public void SetValue(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | The hardcoded value, or formula to evaluate dynamically, to provide as default when creating a new Entity |
UpdateNewItem(UserInfo, IReadOnlyCache, IEntityUpdater, object, string)
Given a new instance of this item this updates the specified property with the stored hard coded value or by evaluating the formula
Declaration
public abstract Task UpdateNewItem(UserInfo user, IReadOnlyCache cache, IEntityUpdater updater, object item, string propNameToDefault)
Parameters
Type | Name | Description |
---|---|---|
UserInfo | user | The current user that created this new item |
IReadOnlyCache | cache | |
IEntityUpdater | updater | |
object | item | The new item that has a default value to be evaluated and created |
string | propNameToDefault | The property to be updated with the default value |
Returns
Type | Description |
---|---|
Task | A task indicating completion of this operation. Can take time if the value is a formula that requires evaluation |
UpdateNewValue(object, object, string)
Declaration
protected void UpdateNewValue(object newValue, object item, string propNameToDefault)
Parameters
Type | Name | Description |
---|---|---|
object | newValue | |
object | item | |
string | propNameToDefault |