Class GraphExtension
Applies the includes of a Graph<T> to an IQueryable<T> for Entity Framework Core.
public static class GraphExtension
- Inheritance
-
GraphExtension
- Inherited Members
Methods
ApplyReferences<TProperty, T>(Graph<T>, IQueryable<T>, Expression<Func<T, TProperty>>)
Applies the includes of the graph that start with a given first-level property.
[RequiresUnreferencedCode("The include paths are turned into Include and ThenInclude calls by looking up the properties by name with reflection: trimming can remove them.")]
[RequiresDynamicCode("The Include and ThenInclude calls are built at runtime (generic methods and expression trees), which native AOT may not support.")]
public static IQueryable<T> ApplyReferences<TProperty, T>(this Graph<T> graph, IQueryable<T> query, Expression<Func<T, TProperty>> path) where TProperty : class where T : class
Parameters
graphGraph<T>The graph holding the include paths.
queryIQueryable<T>The query to complete.
pathExpression<Func<T, TProperty>>An expression selecting a property of the root type (one level only).
Returns
- IQueryable<T>
The query with the matching includes (and their
ThenIncludes) applied.
Type Parameters
TPropertyThe type of the property.
TThe aggregate root type.
Exceptions
- ArgumentNullException
queryis null.- InvalidOperationException
pathgoes deeper than one level.
ApplySetReferences<T>(Graph<T>, IQueryable<T>)
Applies every include path of the graph (collections included) on the IQueryable<T>, using Include and ThenInclude.
[RequiresUnreferencedCode("The include paths are turned into Include and ThenInclude calls by looking up the properties by name with reflection: trimming can remove them.")]
[RequiresDynamicCode("The Include and ThenInclude calls are built at runtime (generic methods and expression trees), which native AOT may not support.")]
public static IQueryable<T> ApplySetReferences<T>(this Graph<T> graph, IQueryable<T> query) where T : class
Parameters
graphGraph<T>The graph holding the include paths.
queryIQueryable<T>The query to complete.
Returns
- IQueryable<T>
The query with every include of the graph applied.
Type Parameters
TThe aggregate root type.
ApplySingleReferences<T>(Graph<T>, IQueryable<T>)
Will apply the includes on the IQueryable<T> but the types having an association based on IEnumerable.
[RequiresUnreferencedCode("The include paths are turned into Include and ThenInclude calls by looking up the properties by name with reflection: trimming can remove them.")]
public static IQueryable<T> ApplySingleReferences<T>(this Graph<T> graph, IQueryable<T> query) where T : class
Parameters
graphGraph<T>The graph holding the include paths.
queryIQueryable<T>The query to complete.
Returns
- IQueryable<T>
The query with the single-valued includes applied.
Type Parameters
TThe aggregate root type.
Exceptions
- ArgumentNullException
queryis null.