Often we might need to access some data in read-only mode. This data can be denormalized and aggregated to, for example, produce a report on screen or on paper. In this case, we might want to use database views to retrieve the data and map data transfer objects (DTOs) to those views.
A typical sample would be retrieving a list of the top 10 customers of the month including the customer name, the number of orders, and the total value of the orders placed during the month of interest. Let's assume we have created a database view to collect all this data. The view is called
Top10CustomersOfMonth and has the fields
Let's also assume we have the DTO