Consider supporting ExecuteDelete targeting complex types
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
While we support ExecuteUpdate on and within complex-mapped JSON columns, we do not support ExecuteDelete. Possible behaviors:
* ExecuteDelete over a projected non-collection complex type would be the same as ExecuteUpdate setting it to null. So `context.Blogs.Select(b => b.Details).ExecuteDeleteAsync()` would null out all the properties for table splitting, or assign null (or remove the property) for JSON. Since it's already possible to do this with ExecuteDelete, it doesn't seem very valuable.
* ExecuteDelete over a nested JSON collection would remove the matching elements in that JSON collection.
* However,The implementation here is likely to be impossible on most databases, as removal is only supported given a simple path in the document.
* In theory, we can transform the JSON collection to relational via OPENJSON, but we'd then have to extract out the array indexes in order to somehow pass them back to the database's JSON removal function (this is made trickier by the fact that the number of removals to be done isn't known in advance).
* The above can also be split down to two roundtrips - a query to get out the array indexes of the relevant items, and then an UPDATE to apply the change. But that's well beyond the (current) scope of Execute* (multi-statement operations, transactions...).
Putting on the backlog - I don't think we'll be doing anything in this area anytime soon.
Contributor guide
Assessment
This issue has not been assessed yet.