[release/6.0] Temporal table support for owned and table splitting scenarios #27369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix to #26858 - Query: improve TableExpressionBase extensibility by adding annotations
Fix to #26469 - Query: enable temporal tables for table splitting scenarios
Fix to #26451 - Temporal Table: Owned Entities support?
Added annotation infra for TableExpressionBase and annotations for temporal table information. Removed (now unnecessary) temporal specific table expressions.
Also added temporal table support for owned typed and table splitting in general using the annotations to store the temporal information (no need for provider specific logic in places where we didn't have good extensibility)
For table splitting, every entity must explicitly define period start/end columns. They all need to be the same, but if not explicitly provided we try to uniquefy them. We should fix this so that you only need to specify it in one place but it's currently hard to do (hopefully convention layering will make it easier)
Description
Temporal table feature was disabled for shared/owned types. This change enables the functionality - it requires refactoring to some sql expressions used by EF internally, as well as slightly modifying model builders to fix bug in nested temporal type declarations using conventions. (which often appears in owned type scenarios)
Customer impact
Customers were unable to use owned/share types with temporal tables feature.
How found
Issue was known to us. Decision based on feedback from multiple customers as well as from partners within Microsoft.
Regression
No. Temporal tables is a new feature in 6.0
Testing
Added extensive testing for owned/shared type scenarios (over 500 test cases) .
Risk
Medium. This is a large change (for a patch) which involves additional API and slightly different mechanism for building temporal table conventions. Added quirk to revert to previous behavior, but it doesn't revert 100% - model builder / convention changes will behave in new way even after the quirk has been applied. The change should only affect temporal table scenarios.