public void Can_only_override_lower_or_equal_source_IsEagerLoaded() { var builder = CreateInternalNavigationBuilder(); IConventionNavigation metadata = builder.Metadata; Assert.False(metadata.IsEagerLoaded); Assert.Null(metadata.GetIsEagerLoadedConfigurationSource()); Assert.True(builder.CanSetAutoInclude(autoInclude: true, ConfigurationSource.DataAnnotation)); Assert.NotNull(builder.AutoInclude(autoInclude: true, ConfigurationSource.DataAnnotation)); Assert.True(metadata.IsEagerLoaded); Assert.Equal(ConfigurationSource.DataAnnotation, metadata.GetIsEagerLoadedConfigurationSource()); Assert.True(builder.CanSetAutoInclude(autoInclude: true, ConfigurationSource.Convention)); Assert.False(builder.CanSetAutoInclude(autoInclude: false, ConfigurationSource.Convention)); Assert.NotNull(builder.AutoInclude(autoInclude: true, ConfigurationSource.Convention)); Assert.Null(builder.AutoInclude(autoInclude: false, ConfigurationSource.Convention)); Assert.True(metadata.IsEagerLoaded); Assert.Equal(ConfigurationSource.DataAnnotation, metadata.GetIsEagerLoadedConfigurationSource()); Assert.True(builder.CanSetAutoInclude(autoInclude: false, ConfigurationSource.DataAnnotation)); Assert.NotNull(builder.AutoInclude(autoInclude: false, ConfigurationSource.DataAnnotation)); Assert.False(metadata.IsEagerLoaded); Assert.Equal(ConfigurationSource.DataAnnotation, metadata.GetIsEagerLoadedConfigurationSource()); Assert.True(builder.CanSetAutoInclude(null, ConfigurationSource.DataAnnotation)); Assert.NotNull(builder.AutoInclude(null, ConfigurationSource.DataAnnotation)); Assert.False(metadata.IsEagerLoaded); Assert.Null(metadata.GetIsEagerLoadedConfigurationSource()); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual bool CanSetAutoInclude(bool?autoInclude, ConfigurationSource configurationSource) { IConventionNavigation conventionNavigation = Metadata; return(configurationSource.Overrides(conventionNavigation.GetIsEagerLoadedConfigurationSource()) || conventionNavigation.IsEagerLoaded == autoInclude); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual bool CanSetIsEagerLoaded(bool?eagerLoaded, ConfigurationSource configurationSource) { IConventionNavigation conventionNavigation = Metadata; return(configurationSource.Overrides(conventionNavigation.GetIsEagerLoadedConfigurationSource()) || conventionNavigation.IsEagerLoaded == eagerLoaded); }