ASP.NET Core Interview question challenge #1 Context:
You're building a backend for an e-commerce platform using ASP.NET Core. Each user interacts with their shopping cart via HTTP requests — adding items, removing items, and viewing the cart. The cart data is stored in a distributed cache (like Redis) and synced with a database periodically.
You’ve created a service called ICartService that:
- Retrieves the cart for the current user
- Updates cart items
- Calculates totals and applies discounts
This service depends on:
- IUserContextService to get the current user ID from the request
- ICartRepository to interact with cache and DB
Question:
Which service lifetime should you use for ICartService in this scenario?
Options:
Rise Academy Career Connect
ASP.NET Core Interview question challenge #1
Context:
You're building a backend for an e-commerce platform using ASP.NET Core. Each user interacts with their shopping cart via HTTP requests — adding items, removing items, and viewing the cart. The cart data is stored in a distributed cache (like Redis) and synced with a database periodically.
You’ve created a service called ICartService that:
- Retrieves the cart for the current user
- Updates cart items
- Calculates totals and applies discounts
This service depends on:
- IUserContextService to get the current user ID from the request
- ICartRepository to interact with cache and DB
Question:
Which service lifetime should you use for ICartService in this scenario?
Options:
3 months ago | [YT] | 0