Azure Cosmos DB for .NET Developers #3: Your Aggregate Root Is Your Document

June 01, 2026
Azure Cosmos DB for .NET Developers #3: Your Aggregate Root Is Your Document

▶ Watch this video on YouTube (opens in a new tab)

For two videos I kept promising we'd get to Cosmos DB, and we kept talking about relational databases instead. Trees, boxes, the impedance mismatch, and all the adapter-and-repository plumbing you build just to chop a tree into tables and glue it back together.

Here's the idea that cracks the egg: in Cosmos, your domain object is the stored document. JSON lets the tree survive the trip to storage and back — no schema files, no joins, no reassembly. The thing you code is the thing you store.

Which raises the obvious worry: where do the boundaries go? That's the aggregate root. Fancy name, simple test: delete the parent — should this thing disappear too? Yes means it lives inside the document. No means it's a separate one. That one question gets you embarrassingly far.

The twist: EF Core only hopes your team respects those boundaries. Cosmos makes them physical. And yes — I denormalize on purpose, because storage is cheap and a snapshot beats a join.

The full walkthrough, with a real Order/Customer/Product model, is in the video.