Beispiel #1
0
        public DeleteValidator(
            IDatabaseScopeFactory databaseScopeFactory,
            IHearFromRepository hearFromRepository)
        {
            _databaseScopeFactory = databaseScopeFactory;
            _hearFromRepository   = hearFromRepository;

            RuleFor(x => x).Custom(Validate);
        }
 public Handler(
     IHearFromRepository hearFromRepository,
     IDatabaseScopeFactory databaseScopeFactory,
     ILogger <Handler> logger)
 {
     _hearFromRepository   = hearFromRepository;
     _databaseScopeFactory = databaseScopeFactory;
     _logger = logger;
 }
Beispiel #3
0
        public UpdateValidator(
            IDatabaseScopeFactory databaseScopeFactory,
            IHearFromRepository hearFromRepository)
        {
            _databaseScopeFactory = databaseScopeFactory;
            _hearFromRepository   = hearFromRepository;

            RuleFor(x => x.Id).NotEmpty()
            .WithMessage("Id 不能为空。");
            RuleFor(x => x.Name).NotEmpty()
            .WithMessage("名称不能为空。");

            RuleFor(x => x).Custom(Validate);
        }