public BookCommandValidator(IBookQueryRepository bookRepository)
        {
            this.RuleFor(c => c.Title)
            .MinimumLength(MinTitleLength)
            .MaximumLength(MaxTitleLength)
            .NotEmpty();

            this.RuleFor(c => c.Publisher)
            .MinimumLength(MinNameLength)
            .MaximumLength(MaxNameLength)
            .NotEmpty();

            this.RuleFor(c => c.Price)
            .InclusiveBetween(Zero, decimal.MaxValue);

            this.RuleFor(c => c.NumberOfPages)
            .InclusiveBetween(MinNumberOfPages, MaxNumberOfPages);

            this.RuleFor(c => c.CoverType)
            .Must(Enumeration.HasValue <CoverType>)
            .WithMessage("'Cover Type' is not valid.");

            this.RuleFor(c => c.CategoryType)
            .Must(Enumeration.HasValue <CategoryType>)
            .WithMessage("'Category Type' is not valid.");
        }
Exemplo n.º 2
0
 public BookDetailsQueryHandler(
     IBookQueryRepository bookRepository,
     IAuthorQueryRepository authorRepository)
 {
     this.bookRepository   = bookRepository;
     this.authorRepository = authorRepository;
 }
 public CreateBookCommandValidator(IBookQueryRepository bookRepository)
 => this.Include(new BookCommandValidator <CreateBookCommand>(bookRepository));
Exemplo n.º 4
0
 public GetBookAuthorsQueryHandler(IBookQueryRepository bookRepository)
 => this.bookRepository = bookRepository;
 public SearchBooksQueryHandler(IBookQueryRepository bookRepository)
     : base(bookRepository)
 {
 }
Exemplo n.º 6
0
 protected BooksQueryHandler(IBookQueryRepository bookRepository)
 => this.bookRepository = bookRepository;