IRowAsyncValidators IRowAsyncValidators.Add(RowAsyncValidator value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(RowAsyncValidators.New(this, value)); }
public IRowAsyncValidators Add(RowAsyncValidator value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(value); }
internal void UpdateAsyncErrors(RowAsyncValidator rowAsyncValidator) { Debug.Assert(CurrentRow != null); var sourceColumns = rowAsyncValidator.SourceColumns; var errors = GetErrors(_asyncErrorsByRow, CurrentRow); errors = Remove(errors, x => !x.Source.SetEquals(sourceColumns)); errors = Merge(errors, rowAsyncValidator.Results); UpdateAsyncErrors(CurrentRow, errors); }
/// <summary> /// Adds async validator. /// </summary> /// <param name="sourceColumns">The source columns of the validator.</param> /// <param name="validator">The delegate to perform validation.</param> /// <param name="displayName">The display name of the validator.</param> /// <returns>This template builder for fluent coding.</returns> public TemplateBuilder AddAsyncValidator(IColumns sourceColumns, Func <DataRow, Task <IEnumerable <string> > > validator, string displayName = null) { if (sourceColumns == null || sourceColumns.Count == 0) { throw new ArgumentNullException(nameof(sourceColumns)); } if (validator == null) { throw new ArgumentNullException(nameof(validator)); } if (string.IsNullOrEmpty(displayName)) { displayName = GetDefaultDisplayName(sourceColumns); } Template.AddAsyncValidator(RowAsyncValidator.Create(displayName, sourceColumns, validator)); return(this); }
public IRowAsyncValidators Add(RowAsyncValidator value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (!IsSealed) { _list.Add(value); return(this); } Debug.Assert(Count > 0); var result = new KeyedRowAsyncValidators(); for (int i = 0; i < Count; i++) { result.Add(this[i]); } result.Add(value); return(result); }
public KeyedRowAsyncValidators(RowAsyncValidator value1, RowAsyncValidator value2) { Debug.Assert(value1 != null && value2 != null); Add(value1); Add(value2); }
internal static IRowAsyncValidators New(RowAsyncValidator value1, RowAsyncValidator value2) { Debug.Assert(value1 != null && value2 != null && value1 != value2); return(new KeyedRowAsyncValidators(value1, value2)); }