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

Not possible to use Temporal tables with entity framework? #7883

Closed
slubowsky opened this issue Mar 15, 2017 · 2 comments
Closed

Not possible to use Temporal tables with entity framework? #7883

slubowsky opened this issue Mar 15, 2017 · 2 comments
Labels
closed-no-further-action The issue is closed and no further action is planned.

Comments

@slubowsky
Copy link

slubowsky commented Mar 15, 2017

Temporal tables have several restrictions https://msdn.microsoft.com/en-us/library/mt604468.aspx including no cascading deletes or "instead of" triggers.

Does this mean that either you cant use entity framework for deletes (and instead need to write custom procedures that delete related entities) or you cant use temporal tables? (I suppose you could also write entity framework code to delete the related items from the bottom up as well but I don't want dozens of little calls from my API app back to my database)

@ajcvickers
Copy link
Member

@slubowsky I believe temporal tables should be usable with EF, with a couple of limitations as described here: #4693.

With regard to cascade deletes, EF does not require cascade deletes on the database in order to function correctly. However, if the database does not have cascade deletes, then all related entities must be loaded into the context before the delete happens to ensure that everything is deleted that should be.

@ajcvickers ajcvickers added the closed-no-further-action The issue is closed and no further action is planned. label Mar 15, 2017
@slubowsky
Copy link
Author

@ajcvickers Thanks. I didn't know that. I thought delete cascade was the only way to get this kind of behavior in EF. Only other place I see this is in another post by you #5871. Perhaps this should be somewhere in the documentation, or maybe it already is and I'm just not finding it.
Ill have to play with this. If I can get it to do minimal loading using projections maybe Ill give it a shot so all my code is in one place, otherwise I guess Ill stick with stored procedures for efficiency.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned.
Projects
None yet
Development

No branches or pull requests

2 participants