/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual void SetIsLoaded([NotNull] INavigation navigation, bool loaded = true) { if (!loaded && !navigation.IsCollection() && this[navigation] != null) { throw new InvalidOperationException( CoreStrings.ReferenceMustBeLoaded(navigation.Name, navigation.DeclaringEntityType.DisplayName())); } _stateData.FlagProperty(navigation.GetIndex(), PropertyFlag.IsLoaded, isFlagged: loaded); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual bool IsLoaded([NotNull] INavigation navigation) => (!navigation.IsCollection() && EntityState != EntityState.Detached && this[navigation] != null) || _stateData.IsPropertyFlagged(navigation.GetIndex(), PropertyFlag.IsLoaded);
private int GetNavigationStateDataIndex(INavigation navigation) => navigation.GetIndex() - EntityType.PropertyCount();