NavigationEntry.IsLoaded Property

Definition

Gets or sets a value indicating whether the entity or entities referenced by this navigation property are known to be loaded.

public virtual bool IsLoaded { get; set; }
member this.IsLoaded : bool with get, set
Public Overridable Property IsLoaded As Boolean

Property Value

true if all the related entities are loaded or the IsLoaded has been explicitly set to true.

Remarks

Loading entities from the database using Include<TEntity,TProperty>(IQueryable<TEntity>, Expression<Func<TEntity,TProperty>>) or ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>) , Load(), or LoadAsync(CancellationToken) will set this flag. Subsequent calls to Load() or LoadAsync(CancellationToken) will then be a no-op.

It is possible for IsLoaded to be false even if all related entities are loaded. This is because, depending on how entities are loaded, it is not always possible to know for sure that all entities in a related collection have been loaded. In such cases, calling Load() or LoadAsync(CancellationToken) will ensure all related entities are loaded and will set this flag to true.

See Accessing tracked entities in EF Core and Loading related entities for more information and examples.

Applies to