Class DatabaseValidationAttribute
This indicates the validation is only run if the code is executing directly connected to the database. If running through the web service this will not be executed. This is for performance on validations to only run db checks once from the service, and also because running async code synchronously can lock up UI - especially Xamarin UI
Inheritance
DatabaseValidationAttribute
Inherited Members
Namespace: LemonEdge.API.Attributes.Validation
Assembly: LemonEdge.API.dll
Syntax
public abstract class DatabaseValidationAttribute : ValidationAttribute
Constructors
DatabaseValidationAttribute()
Declaration
protected DatabaseValidationAttribute()
Properties
RequiresValidationContext
Declaration
public override sealed bool RequiresValidationContext { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
IsValid(object, IEntityUpdater, IReadOnlyCache, UserInfo, ValidationContext)
The validation method to return if the item, and changes, are valid or not
Declaration
protected abstract 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 |
IsValid(object, ValidationContext)
Declaration
protected override sealed ValidationResult IsValid(object value, ValidationContext validationContext)
Parameters
Type | Name | Description |
---|---|---|
object | value | |
ValidationContext | validationContext |
Returns
Type | Description |
---|---|
ValidationResult |