Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop combining delete and insert pairs into updates #30705

Open
Tracked by #22959
ajcvickers opened this issue Apr 17, 2023 · 5 comments
Open
Tracked by #22959

Stop combining delete and insert pairs into updates #30705

ajcvickers opened this issue Apr 17, 2023 · 5 comments

Comments

@ajcvickers
Copy link
Member

When two entity types share the same table, then deleting an instance and inserting a new instance into the same row is combined into an update for the row. This makes sense for table sharing, but we also started doing this for entities mapped to different tables. This causes problems when:

Therefore, we should stop doing this except where needed for table sharing.

@roji
Copy link
Member

roji commented Apr 17, 2023

I'm not sure what we decided any more, but assuming we support optional dependents for table sharing (do we?), would it still make sense to go through the motions of doing delete and insert like we'd do for non-table-sharing? Basically I'd expect Remove/Add to perform exactly the same regardless of whether there's a SaveChanges in between - except where doing that would raise an exception (i.e. non-optional table sharing).

@ajcvickers
Copy link
Member Author

But then we would have to also delete the other entities sharing the table, and re-create those, which would have different side effects.

@roji
Copy link
Member

roji commented Apr 17, 2023

But I'd assume that if we support optional table sharing, it should already be possible to delete the dependent without deleting the principal no? And if so, there's no reason to merge the delete/add for that case...

@ajcvickers
Copy link
Member Author

We can discuss.

@ajcvickers
Copy link
Member Author

See also the issue described here: #33653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants