Class ReadOnlyAttribute
Indicates this property is read-only and can not be modified again by anything once it has been initially saved from new
For instance this is commonly used with auto-increment reference ids used in transactions
Requires the DBTrackChangesAttribute to be marked against this property as well
Inherited Members
Namespace: LemonEdge.API.Attributes.Validation
Assembly: LemonEdge.API.dll
Syntax
[AttributeUsage(AttributeTargets.Property)]
public class ReadOnlyAttribute : DatabaseValidationAttribute
Constructors
ReadOnlyAttribute()
Declaration
public ReadOnlyAttribute()
Methods
IsValid(object, IEntityUpdater, IReadOnlyCache, UserInfo, ValidationContext)
The validation method to return if the item, and changes, are valid or not
Declaration
protected override Task<ValidationResult> IsValid(object value, IEntityUpdater dbCon, IReadOnlyCache cache, UserInfo user, ValidationContext validationContext)
Parameters
Type | Name | Description |
---|---|---|
object | value | The item to be validated |
IEntityUpdater | dbCon | A connection to the database to use for validation |
IReadOnlyCache | cache | A local cache of current items to speed validation |
UserInfo | user | The current logged in user who made the changes |
ValidationContext | validationContext | The validation context across all changes |
Returns
Type | Description |
---|---|
Task<ValidationResult> | A task holding the validation result |