public static void EnsureValid(GuidDataRequest data, string parent = null)
 {
     if (!ValidationFunctions.MaxLengthNullable(data.User, 255, out var messageUser))
     {
         throw new ValidationException("user"._path(parent), messageUser);
     }
     if (!ValidationFunctions.ExpireNullable(data.Expire, out var expire, out var messageExpire))
     {
         throw new ValidationException("expire"._path(parent), messageExpire);
     }
 }
Exemple #2
0
        /// <summary>
        /// Validator for Guid
        /// </summary>
        public static void EnsureValid(string data, string parent = null)
        {
            var property = "guid"._path(parent);

            if (!ValidationFunctions.StringRequired(data, out var messageRequired))
            {
                throw new ValidationException(property, messageRequired);
            }

            if (!ValidationFunctions.GuidNullable(data, out var guid, out var messageGuid))
            {
                throw new ValidationException(property, messageGuid);
            }
        }