How It Works
The code in the Code Behind executes a LINQ to Entities query that retrieves all the reviews that belong to the user’s favorite genres. For anonymous users, the list of favorite genres will be empty so they always get to see the message about setting their preferences in the Profi le page. To avoid an unnecessary call to the database, the query is executed only when the user has selected at least one preferred genre by checking the Count property of the FavoriteGenres list.