RelationalQueryableExtensions.AsSingleQuery<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.
Returns a new query which is configured to load the collections in the query results in a single database query.
public static System.Linq.IQueryable<TEntity> AsSingleQuery<TEntity> (this System.Linq.IQueryable<TEntity> source) where TEntity : class;
static member AsSingleQuery : System.Linq.IQueryable<'Entity (requires 'Entity : null)> -> System.Linq.IQueryable<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function AsSingleQuery(Of TEntity As Class) (source As IQueryable(Of TEntity)) As IQueryable(Of TEntity)
Type Parameters
- TEntity
The type of entity being queried.
Parameters
- source
- IQueryable<TEntity>
The source query.
Returns
A new query where collections will be loaded through single database query.
Remarks
This behavior generally guarantees result consistency in the face of concurrent updates (but details may vary based on the database and transaction isolation level in use). However, this can cause performance issues when the query loads multiple related collections.
The default query splitting behavior for queries can be controlled by UseQuerySplittingBehavior(QuerySplittingBehavior).
See EF Core split queries for more information and examples.
Applies to
Entity Framework