Esempio n. 1
0
 public override bool IsValid()
 {
     return(!(
                base.IsValid() ||
                ArgumentHelper.IsNullOrEmpty(Schema)
                ));
 }
Esempio n. 2
0
 public virtual bool IsValid()
 {
     return(!(
                ArgumentHelper.IsNullOrEmpty(Server) ||
                ArgumentHelper.IsNullOrEmpty(Database) ||
                ArgumentHelper.IsNullOrEmpty(User) ||
                ArgumentHelper.IsNullOrEmpty(Password)
                ));
 }
Esempio n. 3
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            var id = (TId)context.PropertyValue;

            // TODO Should be handled by NotEmpty, NotNull... and expect here to have a value?
            if (ArgumentHelper.IsNullOrEmpty(id))
            {
                // TODO Shouldn't that return false / throw an exception instead?
                return(true);
            }

            var exists = _repository.Exists(id).Result;

            return(!exists);
        }
Esempio n. 4
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            // TODO Should be handled by NotEmpty, NotNull... and expect here to have a value?
            // TODO Check if that works...
            if (context.Rule.TypeToValidate == typeof(TId) && ArgumentHelper.IsNullOrEmpty((TId)context.PropertyValue))
            {
                return(true);
            }

            if (_predicate == null)
            {   // Check if id (property value) exists
                var id     = (TId)context.PropertyValue;
                var exists = _repository.Exists(id).Result;

                return(exists);
            }

            // Check if given condition has a result
            var buildPredicate = GeneratorEqualityTest(_predicate, context.PropertyValue);
            var item           = _repository.FindByAsync(buildPredicate).Result;

            return(item != null);
        }