SqlServerDbSetExtensions.TemporalBetween<TEntity> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Applies temporal 'Between' 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> TemporalBetween<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> source, DateTime utcFrom, DateTime utcTo) where TEntity : class;
static member TemporalBetween : Microsoft.EntityFrameworkCore.DbSet<'Entity (requires 'Entity : null)> * DateTime * DateTime -> System.Linq.IQueryable<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function TemporalBetween(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
An IQueryable<T> representing the entities present in a given time range.
Remarks
Elements that were created at the starting point are not included in the results, however 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.