Develop
Customise the Wish list add-on further.
Architecture
Data access layer
The Repository class contains all the methods to persist and manipulate data in the database. It does not contain business logic except sorting of the list items, selecting lists and adding existing list items.
Business logic layer
Business logic is implemented with the Service class (WishListService class from version 2) and implementations of IUserContext. It ensures that the wish list products of a logged in user has a user id but no cookie id. Wish list products of an anonymous user has a cookie id but not a user id. It also handles cookie generation and that the lists and their items are cached in the session.
UserContext handles anonymous users' and logged in users' own wish list products. It uses CurrentState in order to return user, website and shopping cart information. It also handles cookie generation and look up for anonymous users and caching in the session.
AdminUserContext is used for administrators to handle other person's wish list products. It is possible to pass user, website and token information to the AdminUserContext. It processes the data directly through the repository. There is no caching in the session for the AdminUserContext. It does not handle cookies or shopping carts.
Note! Modifying a user's wish list, while the user has an on-going session may result in unexpected data loss to the user.
Data carriers
The List and ListItem classes are data carriers. They have no logic implemented. They are used to carry data between data, business logic and representation layer.