예제 #1
0
        /// <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);
        }
예제 #2
0
 /// <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);
예제 #3
0
 private int GetNavigationStateDataIndex(INavigation navigation)
 => navigation.GetIndex() - EntityType.PropertyCount();