コード例 #1
0
 IRowAsyncValidators IRowAsyncValidators.Add(RowAsyncValidator value)
 {
     if (value == null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     return(RowAsyncValidators.New(this, value));
 }
コード例 #2
0
            public IRowAsyncValidators Add(RowAsyncValidator value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException(nameof(value));
                }

                return(value);
            }
コード例 #3
0
        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);
        }
コード例 #4
0
 /// <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);
 }
コード例 #5
0
            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);
            }
コード例 #6
0
 public KeyedRowAsyncValidators(RowAsyncValidator value1, RowAsyncValidator value2)
 {
     Debug.Assert(value1 != null && value2 != null);
     Add(value1);
     Add(value2);
 }
コード例 #7
0
 internal static IRowAsyncValidators New(RowAsyncValidator value1, RowAsyncValidator value2)
 {
     Debug.Assert(value1 != null && value2 != null && value1 != value2);
     return(new KeyedRowAsyncValidators(value1, value2));
 }