dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.68k stars 3.17k forks source link

Cosmos: Validate our current container mapping strategy #34005

Closed roji closed 2 months ago

roji commented 3 months ago

We currently map all entity types to the same container by default, and include a discriminator predicate in all queries.

roji commented 3 months ago

Note that the single container we currently map to is by default named after the context CLR type, so e.g. NorthwindContext. If we're changing things in this area, we may want to chop off "Context", which doesn't seem like it belongs in the database.

ajcvickers commented 2 months ago

We discussed this at length with the Cosmos team and decided to keep the mapping to a single container. Mapping to many different containers may defeat efficiency on the Cosmos side when used with certain throughput options. It may still be necessary or desirable to model with multiple containers, but we don't do this by convention in EF Core.