The New Data Access Component

On top of the database layer, we needed a component that could use the stored procedures for adding, deleting, and getting a list of wish lists. For MyGolfGear.NET, the new component WishList.cs was created. This component is made up of the two private fields named userid and connectionstring as well as three public methods called GetWishList, AddToWishList, and DeleteFromWishList. It also implements the Wishlist constructor.

The Wishlist Constructor

The two private fields userid and connectionstring have their values assigned only in the constructor. Listing 9.4 shows the namespace and class declarations as well as private fields and the constructor.

Listing 9.4. Wishlist.cs
 namespace MyGolfGear { using System; ...

Get Building e-Commerce Sites with the .NET Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.