Whiteboard Questions
Architecture Questions
Q: Explain Clean Architecture layers A: Domain (entities, business logic), Application (use cases, CQRS), Infrastructure (data access, external services), Presentation (API endpoints)
Q: What is CQRS and when to use it? A: Command Query Responsibility Segregation. Separate read and write operations. Use when read/write patterns differ significantly.
Q: Repository pattern - pros and cons? Pros: Abstraction, testability, centralized data logic Cons: Additional layer, can be over-engineering for simple apps
Performance Questions
Q: How do you solve N+1 query problem? A: Use Include() for eager loading, or Select() for projection, or AsSplitQuery() for multiple collections
Q: When to use caching? A: Frequently accessed, rarely changing data. Consider in-memory for single server, distributed (Redis) for multiple servers.
Security Questions
Q: JWT vs Cookie authentication? A: JWT: stateless, scalable, good for APIs. Cookies: stateful, good for traditional web apps, easier session management.
Q: How to prevent SQL injection? A: Use parameterized queries (EF Core does this by default), validate input, use ORM properly.