Cosmos: Use ReadItem when a concrete discriminator is manually specified in the predicate
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
When the discriminator is part of the id property (this is no longer the default), we currently don't use ReadItem when a base type is being queried; this is because we don't know what the actual concrete of the type in the database is, so we can't construct its id property for ReadItem.
However, if the user explicitly specifies a concrete discriminator, either via `.Where(b => b.Discriminator == "Blog")` or via `context.Blogs.Where(b => b.GetType() == typeof(Blog))`, we could use ReadItem as we know exactly what we're looking for. The tricky thing there, is that there will still be the EF-injected WHERE c["Discriminator"] IN ("Blog", "SpecialBlog"), which we would need to know to ignore because of the more restrictive user comparison. This can be done, but isn't trivial...
Contributor guide
Assessment
This issue has not been assessed yet.