Improving the validation mechanism

As we explained in the previous chapter, we are using the FluentValidation package to implement the validation mechanism of the web service. Since we have built the service interfaces to handle the Artist and Genre entities, it is now possible to improve the validation checks already present in the AddItemRequestValidator and EditItemRequestValidator classes. Now, we are going to implement the existence check for the Artist- and Genre-related entities.

Let's start by extending the implementation of the AddItemRequestValidator class:

using System;using FluentValidation;using System.Threading.Tasks;using Catalog.Domain.Requests.Artists;using Catalog.Domain.Requests.Genre;using Catalog.Domain.Services;namespace ...

Get Hands-On RESTful Web Services with ASP.NET Core 3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.