Table of Contents

Class GraphExtension

Namespace
Arc4u.EfCore
Assembly
Arc4u.EfCore.dll

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

graph Graph<T>

The graph holding the include paths.

query IQueryable<T>

The query to complete.

path Expression<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

TProperty

The type of the property.

T

The aggregate root type.

Exceptions

ArgumentNullException

query is null.

InvalidOperationException

path goes 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

graph Graph<T>

The graph holding the include paths.

query IQueryable<T>

The query to complete.

Returns

IQueryable<T>

The query with every include of the graph applied.

Type Parameters

T

The 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

graph Graph<T>

The graph holding the include paths.

query IQueryable<T>

The query to complete.

Returns

IQueryable<T>

The query with the single-valued includes applied.

Type Parameters

T

The aggregate root type.

Exceptions

ArgumentNullException

query is null.