Share via


SqlServerDbSetExtensions.TemporalAsOf<TEntity> Method

Definition

Applies temporal 'AsOf' operation on the given DbSet, which only returns elements that were present in the database at a given point in time.

public static System.Linq.IQueryable<TEntity> TemporalAsOf<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> source, DateTime utcPointInTime) where TEntity : class;
static member TemporalAsOf : Microsoft.EntityFrameworkCore.DbSet<'Entity (requires 'Entity : null)> * DateTime -> System.Linq.IQueryable<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function TemporalAsOf(Of TEntity As Class) (source As DbSet(Of TEntity), utcPointInTime As DateTime) As IQueryable(Of TEntity)

Type Parameters

TEntity

Parameters

source
DbSet<TEntity>

Source DbSet on which the temporal operation is applied.

utcPointInTime
DateTime

DateTime representing a point in time for which the results should be returned.

Returns

IQueryable<TEntity>

An IQueryable representing the entities at a given point in time.

Remarks

Temporal information is stored in UTC format on the database, so any DateTime arguments in local time may lead to unexpected results.

Temporal queries are always set as 'NoTracking'.

See Using SQL Server temporal tables with EF Core for more information and examples.

Applies to