Class DatabaseValidation
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
System.Object
System.Attribute
System.ComponentModel.DataAnnotations.ValidationAttribute
DatabaseValidation
Inherited Members
System.ComponentModel.DataAnnotations.ValidationAttribute.FormatErrorMessage(System.String)
System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(System.Object, System.ComponentModel.DataAnnotations.ValidationContext)
System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(System.Object)
System.ComponentModel.DataAnnotations.ValidationAttribute.Validate(System.Object, System.ComponentModel.DataAnnotations.ValidationContext)
System.ComponentModel.DataAnnotations.ValidationAttribute.Validate(System.Object, System.String)
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessage
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageResourceName
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageResourceType
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageString
System.Attribute.Equals(System.Object)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetHashCode()
System.Attribute.IsDefaultAttribute()
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Attribute.TypeId
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: LemonEdge.API.Attributes.Validation
Assembly: API.dll
Syntax
public abstract class DatabaseValidation : ValidationAttribute
Properties
RequiresValidationContext
Declaration
public override sealed bool RequiresValidationContext { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
System.ComponentModel.DataAnnotations.ValidationAttribute.RequiresValidationContext
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 |
---|---|---|
System.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 |
System.ComponentModel.DataAnnotations.ValidationContext | validationContext | The validation context across all changes |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ComponentModel.DataAnnotations.ValidationResult> | A task holding the validation result |
IsValid(Object, ValidationContext)
Declaration
protected override sealed ValidationResult IsValid(object value, ValidationContext validationContext)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | |
System.ComponentModel.DataAnnotations.ValidationContext | validationContext |
Returns
Type | Description |
---|---|
System.ComponentModel.DataAnnotations.ValidationResult |
Overrides
System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(System.Object, System.ComponentModel.DataAnnotations.ValidationContext)