All queries using temporal operators are no-tracking by default, so the returned entity here is not tracked. This query returns a single row for Rainbow Dash as it was at the given UTC time. This was clearly a mistake, so let's go back to a point-in-time and restore the missing row from that time. This query returns the following rows: Historical data for Rainbow Dash between 4:41:14 PM and 4:42:44 PM:Īs mentioned above, Rainbow Dash was deleted from the Employees table. OrderBy(e => EF.Property(e, "ValidFrom")) Similar queries can be written using TemporalFromTo, TemporalBetween, or TemporalContainedIn. ![]() We will see later how this data can be restored. This is because the row for Rainbow Dash was deleted from the main table at that time. Notice that the last row returned stopped being active at 4:44:59 PM. ![]() This query brings back the following data: Historical data for Rainbow Dash:Įmployee Rainbow Dash was 'Ponyville weather patrol' from 4:38:58 PM to 4:40:29 PMĮmployee Rainbow Dash was 'Wonderbolt Trainee' from 4:40:29 PM to 4:41:59 PMĮmployee Rainbow Dash was 'Wonderbolt Reservist' from 4:41:59 PM to 4:43:29 PMĮmployee Rainbow Dash was 'Wonderbolt' from 4:43:29 PM to 4:44:59 PM This is used in the OrderBy clause to sort the data, and then in a projection to include these values in the returned data. Notice how the EF.Property method can be used to access values from the period columns. For example, consider an Employee entity type: public class Employee When using EF Core to create the database, the new table will be configured as a temporal table with the SQL Server defaults for the timestamps and history table. ToTable("Employees", b => b.IsTemporal()) The model builder can be used to configure a table as temporal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |