concept shopping basket in category .net

This is an excerpt from Manning's book Dependency Injection in .NET.
The logical next step is to introduce a shopping basket feature. Figure 2.23 shows a screenshot of the shopping basket in use.
Figure 2.23. The spectacularly feature-poor shopping basket in the refactored commerce sample application.
![]()
To support a shopping basket for each user, I need a Basket, a BasketRepository, and a host of supporting classes. If you’re like me, you want to see the Basket class first: figure 2.24 shows the basket and its list of items.
The SQL Server–based implementation I exhibited in listing 4.10 certainly performs a database query every single time you ask it about an exchange rate. When the application displays a shopping basket, each item in the basket is being converted, so this leads to a database query for every item in the basket even though the rate is unlikely to change from the first to the last item. It would be better to cache the exchange rate for a little while so that the application doesn’t need to hit the database about the same rate several times within the same fraction of a second.