📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Phase 15 — Architecture

Choosing and evolving the architecture of .NET systems: layered, Clean, hexagonal, vertical slice, modular monolith and microservices; architecture-level patterns such as CQRS, events and sagas; Domain-Driven Design; and the senior judgement to match architecture to business needs.

  1. After a release, customers' loyalty balances and order statuses in the Customer service are sometimes wrong: an order shows as Shipped then reverts to Paid, and some points are credited twice. The Customer service consumes integration events from Ordering over Azure Service Bus. How do you investigate and fix the ordering, versioning and idempotency problems?

    A production incident with out-of-order and duplicate integration events corrupting a consumer's state: diagnosing with traces and Service Bus metrics, then fixing with aggregate versions, Service Bus sessions, inbox deduplication, idempotent operations and contract version handling, plus safe data repair.

    Senior RealWorldScenario Architecture Patterns Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. What is a bounded context, and how do you decide where one ends and another begins?
    Junior Theory Domain-Driven Design
  3. How do you decide whether Address should be an entity or a value object in your domain?
    Intermediate Theory Domain-Driven Design
  4. What is Domain-Driven Design? Explain the difference between strategic and tactical design, what a ubiquitous language is, and how you decide whether DDD is worth the effort on a project.

    Covers what DDD is, strategic versus tactical design, the ubiquitous language, and the criteria for when DDD pays off and when it is ceremony.

    Junior Theory Domain-Driven Design Β· πŸ”— 3 follow-ups
  5. What is the difference between an entity and a value object in Domain-Driven Design? Explain identity versus structural equality, why value objects should be immutable, whether C# records make good value objects, and how you map value objects with EF Core 10.

    Covers entities versus value objects, identity and value equality, immutability, records as value objects, and mapping value objects with EF Core 10 complex types and owned types.

    Intermediate Theory Domain-Driven Design Β· πŸ”— 3 follow-ups
  6. What is an aggregate and what is an aggregate root? Explain the aggregate as a consistency boundary, how you decide what goes inside it, why other aggregates are referenced by id, and why the rule is one aggregate per transaction.

    Covers aggregates and aggregate roots, invariants and consistency boundaries, sizing aggregates, referencing by id, and the one-aggregate-per-transaction rule with eventual consistency between aggregates.

    Mid-Level Theory Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. Implement an Order aggregate in C# that enforces its own invariants: private setters, a factory method, behaviour methods instead of property setters, and domain errors returned as results rather than exceptions. Then show how you persist it with EF Core 10 and use it from an application handler.

    Covers implementing a rich Order aggregate in modern C# with a factory method, encapsulated children, invariant checks, a Result type for domain errors, EF Core 10 mapping with backing fields, and a thin application handler.

    Mid-Level Coding Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. How do repositories and services fit into a DDD model? Explain why you have one repository per aggregate root, what makes a domain service different from an application service, and walk through a worked example such as transferring funds between two accounts.

    Covers DDD repositories as collections of aggregates (one per root), domain services versus application services, and a worked funds-transfer example showing where each piece of logic lives.

    Mid-Level Theory Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. What is a bounded context in Domain-Driven Design? How do you find bounded contexts, why does the same word such as "Customer" mean different things in different parts of the business, and how do bounded contexts map to modules, services and teams?

    Covers what a bounded context is, heuristics for finding context boundaries, polysemous terms like Customer, and how contexts map to modules, microservices, databases and teams.

    Mid-Level Theory Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  10. What is context mapping in Domain-Driven Design? Explain the main relationship patterns (partnership, shared kernel, customer-supplier, conformist, anti-corruption layer, open host service and published language, separate ways) and how you choose between them for a real integration.

    Covers DDD context maps, the upstream/downstream relationship and each context-mapping pattern, with how team power, model quality and change rate drive the choice.

    Senior Theory Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  11. Show me how you would build an anti-corruption layer that protects your domain model from a legacy or third-party system. What are the translator, adapter and facade parts, where do they live in a .NET solution, and how do you test it?

    Covers implementing an anti-corruption layer in .NET: a domain-owned port, adapter and translator in infrastructure, a typed HttpClient facade, resilience, error translation and contract tests.

    Mid-Level Coding Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  12. Two account managers edit the same order at the same time. One removes a line, the other applies a discount based on the old total, and the saved order now breaks the rule that discounts never exceed 20% of the total. Nobody got an error. How do you diagnose this lost update and fix it with optimistic concurrency at the aggregate level?

    Covers diagnosing a lost update that breaks an aggregate invariant under concurrent edits, and fixing it with a rowversion on the aggregate root, touching the root on child changes, ETags over HTTP and conflict handling.

    Senior Debugging Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  13. Code review: a Subscription class has only public getters and setters, and a SubscriptionService holds every rule for upgrading, pausing and cancelling. What problems do you flag, in what order, and how do you refactor it towards a rich domain model step by step?

    Covers reviewing an anaemic domain model (public setters, rules in a service), ranking the findings by severity, and refactoring incrementally to a rich model with behaviour methods, value objects and tests.

    Senior CodeReview Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  14. You're starting a new product area with complex rules and several teams. How would you run an event storming session? Explain the format (big picture, process and design level), what comes out of it (domain events, commands, policies, aggregates, bounded contexts, hot spots), and how you turn those outputs into an architecture and a backlog.

    Covers planning and facilitating event storming at big-picture, process and design level, reading its outputs, and turning them into bounded contexts, aggregates, an ADR and a sliced backlog.

    Senior Architecture Domain-Driven Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  15. What is a quality attribute scenario, and how do you turn one into a fitness function that runs in CI?
    Mid-Level Theory Senior-Level Architecture
  16. How do you tell essential complexity from accidental complexity in an existing .NET system?
    Senior Architecture Senior-Level Architecture
  17. How does a consumer-driven contract test differ from an end-to-end integration test, and when would you use each?
    Senior Theory Senior-Level Architecture
  18. How do you choose an architecture for a new .NET system from the business needs rather than from fashion? Explain quality attributes (scalability, availability, modifiability, cost), constraints, team size and skills, and how you turn them into a decision you can defend.

    Choosing an architecture by ranking quality attributes, capturing constraints and team realities, mapping them to options with a decision table, and recording the choice in an ADR.

    Mid-Level Theory Senior-Level Architecture Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  19. How do you avoid over-engineering at the architecture level? What are the warning signs in a .NET system, how do you separate reversible from irreversible decisions, and how do you push back on "we need to build it like Netflix" without blocking real future needs?

    Architecture-level over-engineering: warning signs, one-way vs two-way door decisions, last responsible moment, keeping options open, and how to argue against premature scale.

    Senior Architecture Senior-Level Architecture Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  20. Your team runs a modular monolith and some people want to move to microservices. How do you decide whether and when to split, which module to extract first, and how do you extract it safely without a big-bang rewrite?

    Modular monolith first: the criteria for splitting a module out, choosing the first candidate, and the step-by-step extraction (contract, data, traffic switch) with rollback.

    Senior Architecture Senior-Level Architecture Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me