Skip to content

End-to-end soft delete #19695

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

Closed
ajcvickers opened this issue Jan 24, 2020 · 5 comments
Closed

End-to-end soft delete #19695

ajcvickers opened this issue Jan 24, 2020 · 5 comments

Comments

@ajcvickers
Copy link
Contributor

(Thought we had this on the backlog, but couldn't find it.)

Query filters provide most of the underlying functionality for soft deletes, but they don't allow things like automatically updating an entity to set the flag instead of deleting it. This issue is about making a good end-to-end experience for this.

@AshkanAbd
Copy link

AshkanAbd commented Jul 7, 2020

@ajcvickers This is my proposal for #21524 issue as an implementation for soft deletes. sorry my writing skills for English language is not very good.

@roji
Copy link
Member

roji commented Jul 7, 2020

@AshkanAbd we usually just post design proposals in their relevant github issues, in Markdown - this is easiest to access for everyone and ensures the content never goes away.

I haven't given your document a thorough read, but on principle EF Core generally does not require entities to implement interfaces or inherit from base classes to provide functionality. Any proposal which requires this goes against the current design of the library.

@AshkanAbd
Copy link

AshkanAbd commented Jul 8, 2020

@roji I understand that but this proposal is not just an idea for an implementation, its the best implementation after several projects. I have been tried other implementations in several projects for this feature and because of feedbacks I get from my friends and other developers, I choose this one, other implementations that I have been tried, was really confusing for developers, they were not easy to add or remove from the project. I can implement relations need to delete in "DbContext" but its not clean enough in the project or "OnSoftDelete" for each entity needs to define in the entity's class. Also, soft deletes needs to modify entities because of "DeletedAt" property. Please note that soft deletes is an really useful and important feature that needs to implement in a framework like .Net Core, there is no Nuget package or an implementation that really works. One of reasons that other developers don't want to use EF Core is that the library doesn't support soft deletes. You may need to add some exceptions in the current design of the library.

@ajcvickers
Copy link
Contributor Author

@AshkanAbd I agree with @roji. I don't think this is kind of implementation belongs in the main EF Core codebase. That being said, if you feel that this would be useful to people, then I encourage you to ship it as an extension to EF Core in a NuGet package. It can then be added to https://docs.microsoft.com/en-us/ef/core/extensions/ to help other people find it.

@AndriySvyryd
Copy link
Member

Duplicate of #4025

@AndriySvyryd AndriySvyryd marked this as a duplicate of #4025 Oct 20, 2022
@AndriySvyryd AndriySvyryd closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2022
@ajcvickers ajcvickers removed this from the Backlog milestone Oct 20, 2022
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

4 participants