diff --git a/src/EFCore.Proxies/ProxiesExtensions.cs b/src/EFCore.Proxies/ProxiesExtensions.cs
index 13ef77d6ae1..17b728b8f85 100644
--- a/src/EFCore.Proxies/ProxiesExtensions.cs
+++ b/src/EFCore.Proxies/ProxiesExtensions.cs
@@ -141,15 +141,17 @@ public static DbContextOptionsBuilder UseLazyLoadingProxies(
/// The same builder to allow method calls to be chained.
public static DbContextOptionsBuilder UseLazyLoadingProxies(
this DbContextOptionsBuilder optionsBuilder,
- Action? lazyLoadingProxiesOptionsAction)
+ Action lazyLoadingProxiesOptionsAction)
{
+ Check.NotNull(lazyLoadingProxiesOptionsAction, nameof(lazyLoadingProxiesOptionsAction));
+
var extension = optionsBuilder.Options.FindExtension()
?? new ProxiesOptionsExtension();
((IDbContextOptionsBuilderInfrastructure)optionsBuilder).AddOrUpdateExtension(
extension.WithLazyLoading(useLazyLoadingProxies: true));
- lazyLoadingProxiesOptionsAction?.Invoke(new LazyLoadingProxiesOptionsBuilder(optionsBuilder));
+ lazyLoadingProxiesOptionsAction.Invoke(new LazyLoadingProxiesOptionsBuilder(optionsBuilder));
return optionsBuilder;
}
@@ -202,7 +204,7 @@ public static DbContextOptionsBuilder UseLazyLoadingProxies(
/// The same builder to allow method calls to be chained.
public static DbContextOptionsBuilder UseLazyLoadingProxies(
this DbContextOptionsBuilder optionsBuilder,
- Action? lazyLoadingProxiesOptionsAction)
+ Action lazyLoadingProxiesOptionsAction)
where TContext : DbContext
=> (DbContextOptionsBuilder)UseLazyLoadingProxies((DbContextOptionsBuilder)optionsBuilder, lazyLoadingProxiesOptionsAction);
diff --git a/src/EFCore/ChangeTracking/CollectionEntry.cs b/src/EFCore/ChangeTracking/CollectionEntry.cs
index ec80e21b350..ef39feddb38 100644
--- a/src/EFCore/ChangeTracking/CollectionEntry.cs
+++ b/src/EFCore/ChangeTracking/CollectionEntry.cs
@@ -216,7 +216,7 @@ public override bool IsModified
///
///
/// Options to control the way related entities are loaded.
- public override void Load(LoadOptions options = LoadOptions.Default)
+ public override void Load(LoadOptions options = LoadOptions.None)
{
EnsureInitialized();
@@ -244,7 +244,7 @@ public override void Load(LoadOptions options = LoadOptions.Default)
/// A to observe while waiting for the task to complete.
/// A task that represents the asynchronous save operation.
/// If the is canceled.
- public override Task LoadAsync(LoadOptions options = LoadOptions.Default, CancellationToken cancellationToken = default)
+ public override Task LoadAsync(LoadOptions options = LoadOptions.None, CancellationToken cancellationToken = default)
{
EnsureInitialized();
diff --git a/src/EFCore/ChangeTracking/LoadOptions.cs b/src/EFCore/ChangeTracking/LoadOptions.cs
index 9fb117d01bb..365ca59f4a4 100644
--- a/src/EFCore/ChangeTracking/LoadOptions.cs
+++ b/src/EFCore/ChangeTracking/LoadOptions.cs
@@ -21,7 +21,7 @@ public enum LoadOptions
/// Use to avoid getting these duplicates.
///
///
- Default = 0,
+ None = 0,
///
///
diff --git a/src/EFCore/ChangeTracking/NavigationEntry.cs b/src/EFCore/ChangeTracking/NavigationEntry.cs
index 10c92ae07d7..c6dc69273c2 100644
--- a/src/EFCore/ChangeTracking/NavigationEntry.cs
+++ b/src/EFCore/ChangeTracking/NavigationEntry.cs
@@ -95,7 +95,7 @@ private static INavigationBase GetNavigation(InternalEntityEntry internalEntry,
///
///
/// Options to control the way related entities are loaded.
- public abstract void Load(LoadOptions options = LoadOptions.Default);
+ public abstract void Load(LoadOptions options = LoadOptions.None);
///
/// Loads entities referenced by this navigation property, unless
@@ -115,7 +115,7 @@ private static INavigationBase GetNavigation(InternalEntityEntry internalEntry,
/// A to observe while waiting for the task to complete.
/// A task that represents the asynchronous save operation.
/// If the is canceled.
- public abstract Task LoadAsync(LoadOptions options = LoadOptions.Default, CancellationToken cancellationToken = default);
+ public abstract Task LoadAsync(LoadOptions options = LoadOptions.None, CancellationToken cancellationToken = default);
///
/// Returns the query that would be used by to load entities referenced by
diff --git a/src/EFCore/ChangeTracking/ReferenceEntry.cs b/src/EFCore/ChangeTracking/ReferenceEntry.cs
index 029e09f83cd..c2e53ffa27a 100644
--- a/src/EFCore/ChangeTracking/ReferenceEntry.cs
+++ b/src/EFCore/ChangeTracking/ReferenceEntry.cs
@@ -86,7 +86,7 @@ private void LocalDetectChanges()
///
///
/// Options to control the way related entities are loaded.
- public override void Load(LoadOptions options = LoadOptions.Default)
+ public override void Load(LoadOptions options = LoadOptions.None)
{
if (!IsLoaded)
{
@@ -112,7 +112,7 @@ public override void Load(LoadOptions options = LoadOptions.Default)
/// A to observe while waiting for the task to complete.
/// A task that represents the asynchronous save operation.
/// If the is canceled.
- public override Task LoadAsync(LoadOptions options = LoadOptions.Default, CancellationToken cancellationToken = default)
+ public override Task LoadAsync(LoadOptions options = LoadOptions.None, CancellationToken cancellationToken = default)
=> IsLoaded
? Task.CompletedTask
: TargetFinder.LoadAsync((INavigation)Metadata, InternalEntry, options, cancellationToken);
diff --git a/src/EFCore/Infrastructure/Internal/LazyLoader.cs b/src/EFCore/Infrastructure/Internal/LazyLoader.cs
index 99676c52beb..cfd0a624b0b 100644
--- a/src/EFCore/Infrastructure/Internal/LazyLoader.cs
+++ b/src/EFCore/Infrastructure/Internal/LazyLoader.cs
@@ -117,7 +117,7 @@ public virtual void Load(object entity, [CallerMemberName] string navigationName
entry.Load(
_queryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution
? LoadOptions.ForceIdentityResolution
- : LoadOptions.Default);
+ : LoadOptions.None);
}
catch
{
@@ -161,7 +161,7 @@ public virtual async Task LoadAsync(
await entry.LoadAsync(
_queryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution
? LoadOptions.ForceIdentityResolution
- : LoadOptions.Default,
+ : LoadOptions.None,
cancellationToken).ConfigureAwait(false);
}
catch
diff --git a/src/EFCore/Internal/EntityFinder.cs b/src/EFCore/Internal/EntityFinder.cs
index e5965ae0b7b..9eff76e904b 100644
--- a/src/EFCore/Internal/EntityFinder.cs
+++ b/src/EFCore/Internal/EntityFinder.cs
@@ -639,7 +639,7 @@ public virtual IQueryable Query(INavigation navigation, InternalEntityE
return _queryRoot.Where(e => false);
}
- return Query(navigation, keyValues, entry, LoadOptions.Default);
+ return Query(navigation, keyValues, entry, LoadOptions.None);
}
///
diff --git a/src/EFCore/Internal/ManyToManyLoader.cs b/src/EFCore/Internal/ManyToManyLoader.cs
index 884b02fe2f6..9df213191c4 100644
--- a/src/EFCore/Internal/ManyToManyLoader.cs
+++ b/src/EFCore/Internal/ManyToManyLoader.cs
@@ -200,7 +200,7 @@ public virtual IQueryable Query(InternalEntityEntry entry)
return queryRoot.Where(e => false);
}
- return Query(context, keyValues, entry, LoadOptions.Default);
+ return Query(context, keyValues, entry, LoadOptions.None);
}
private object[]? PrepareForLoad(InternalEntityEntry entry)
diff --git a/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs b/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs
index 0a0d9310bfb..1e8ee4941ba 100644
--- a/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs
+++ b/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs
@@ -422,11 +422,11 @@ public virtual async Task Load_collection_partially_loaded(EntityState state, bo
{
if (async)
{
- await collectionEntry.LoadAsync(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.Default);
+ await collectionEntry.LoadAsync(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.None);
}
else
{
- collectionEntry.Load(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.Default);
+ collectionEntry.Load(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.None);
}
Assert.True(collectionEntry.IsLoaded);
@@ -519,11 +519,11 @@ public virtual async Task Load_collection_partially_loaded_no_explicit_join(Enti
{
if (async)
{
- await collectionEntry.LoadAsync(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.Default);
+ await collectionEntry.LoadAsync(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.None);
}
else
{
- collectionEntry.Load(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.Default);
+ collectionEntry.Load(forceIdentityResolution ? LoadOptions.ForceIdentityResolution : LoadOptions.None);
}
Assert.True(collectionEntry.IsLoaded);
@@ -575,7 +575,7 @@ public virtual void Load_collection_partially_loaded_no_tracking(QueryTrackingBe
collectionEntry.Load(
queryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution
? LoadOptions.ForceIdentityResolution
- : LoadOptions.Default);
+ : LoadOptions.None);
}
context.ChangeTracker.LazyLoadingEnabled = false;