Implementing service classes

Let's proceed with the concrete part of the chapter by implementing the service classes. This layer of abstraction will define the methods that query the data layer, including the IItemRepository interface, and map the resulting data.

As mentioned previously, our service implementation will use DTO classes in order to pass the data through the stack. First of all, let's define the request classes needed by our service. To do that, we can start by creating a new Requests/Item folder structure in the Catalog.Domain project, and by adding a new AddItemRequest.cs file in the folder:

using System;using Catalog.Domain.Entities;namespace Catalog.Domain.Requests.Item{    public class AddItemRequest     {        public string Name ...

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

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