SqlServerDbSetExtensions.TemporalContainedIn<TEntity> Method

Definition

Applies temporal 'ContainedIn' operation on the given DbSet, which only returns elements that were present in the database between two points in time.

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

Type Parameters

TEntity

Parameters

source
DbSet<TEntity>

Source DbSet on which the temporal operation is applied.

utcFrom
DateTime

Point in time representing the start of the period for which results should be returned.

utcTo
DateTime

Point in time representing the end of the period for which results should be returned.

Returns

IQueryable<TEntity>

An IQueryable<T> representing the entities present in a given time range.

Remarks

Elements that were created at the starting point as well as elements that were removed at the end point are included in the results.

All versions of entities in that were present within the time range are returned, so it is possible to return multiple entities with the same key.

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