Share via


LazyLoaderExtensions.Load<TRelated> Method

Definition

Loads a navigation property if it has not already been loaded.

public static TRelated Load<TRelated> (this Microsoft.EntityFrameworkCore.Infrastructure.ILazyLoader loader, object entity, ref TRelated navigationField, string navigationName = default) where TRelated : class;
public static TRelated? Load<TRelated> (this Microsoft.EntityFrameworkCore.Infrastructure.ILazyLoader? loader, object entity, ref TRelated? navigationField, string navigationName = "") where TRelated : class;
static member Load : Microsoft.EntityFrameworkCore.Infrastructure.ILazyLoader * obj * 'Related * string -> 'Related (requires 'Related : null)
<Extension()>
Public Function Load(Of TRelated As Class) (loader As ILazyLoader, entity As Object, ByRef navigationField As TRelated, Optional navigationName As String = Nothing) As TRelated
<Extension()>
Public Function Load(Of TRelated As Class) (loader As ILazyLoader, entity As Object, ByRef navigationField As TRelated, Optional navigationName As String = "") As TRelated

Type Parameters

TRelated

The type of the navigation property.

Parameters

loader
ILazyLoader

The loader instance, which may be null.

entity
Object

The entity on which the navigation property is located.

navigationField
TRelated

A reference to the backing field for the navigation.

navigationName
String

The navigation property name.

Returns

TRelated

The loaded navigation property value, or the navigation property value unchanged if the loader is null.

Remarks

See Lazy loading for more information and examples.

Applies to