diff --git a/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs b/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs
index ea830e15f1f..f7e67e4bbe1 100644
--- a/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs
+++ b/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs
@@ -11,7 +11,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
-using Microsoft.EntityFrameworkCore.Utilities;
#pragma warning disable EF1001 // Accessing annotation names (internal)
@@ -123,8 +122,6 @@ private static readonly MethodInfo _indexHasFilterNameMethodInfo
/// Parameter object containing dependencies for this service.
public AnnotationCodeGenerator(AnnotationCodeGeneratorDependencies dependencies)
{
- Check.NotNull(dependencies, nameof(dependencies));
-
Dependencies = dependencies;
}
@@ -393,12 +390,7 @@ public virtual IReadOnlyList GenerateDataAnnotationAttrib
/// if code must be generated.
///
protected virtual bool IsHandledByConvention(IModel model, IAnnotation annotation)
- {
- Check.NotNull(model, nameof(model));
- Check.NotNull(annotation, nameof(annotation));
-
- return false;
- }
+ => false;
///
/// Checks if the given is handled by convention when
@@ -411,12 +403,7 @@ protected virtual bool IsHandledByConvention(IModel model, IAnnotation annotatio
/// The .
/// .
protected virtual bool IsHandledByConvention(IEntityType entityType, IAnnotation annotation)
- {
- Check.NotNull(entityType, nameof(entityType));
- Check.NotNull(annotation, nameof(annotation));
-
- return false;
- }
+ => false;
///
/// Checks if the given is handled by convention when
@@ -429,12 +416,7 @@ protected virtual bool IsHandledByConvention(IEntityType entityType, IAnnotation
/// The .
/// .
protected virtual bool IsHandledByConvention(IKey key, IAnnotation annotation)
- {
- Check.NotNull(key, nameof(key));
- Check.NotNull(annotation, nameof(annotation));
-
- return false;
- }
+ => false;
///
/// Checks if the given is handled by convention when
@@ -447,12 +429,7 @@ protected virtual bool IsHandledByConvention(IKey key, IAnnotation annotation)
/// The .
/// .
protected virtual bool IsHandledByConvention(IProperty property, IAnnotation annotation)
- {
- Check.NotNull(property, nameof(property));
- Check.NotNull(annotation, nameof(annotation));
-
- return false;
- }
+ => false;
///
/// Checks if the given is handled by convention when
@@ -465,12 +442,7 @@ protected virtual bool IsHandledByConvention(IProperty property, IAnnotation ann
/// The .
/// .
protected virtual bool IsHandledByConvention(IForeignKey foreignKey, IAnnotation annotation)
- {
- Check.NotNull(foreignKey, nameof(foreignKey));
- Check.NotNull(annotation, nameof(annotation));
-
- return false;
- }
+ => false;
///
/// Checks if the given is handled by convention when
@@ -483,12 +455,7 @@ protected virtual bool IsHandledByConvention(IForeignKey foreignKey, IAnnotation
/// The .
/// .
protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotation)
- {
- Check.NotNull(index, nameof(index));
- Check.NotNull(annotation, nameof(annotation));
-
- return false;
- }
+ => false;
///
/// Returns a fluent API call for the given , or
@@ -501,12 +468,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(IModel model, IAnnotation annotation)
- {
- Check.NotNull(model, nameof(model));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -519,12 +481,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(IEntityType entityType, IAnnotation annotation)
- {
- Check.NotNull(entityType, nameof(entityType));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -537,12 +494,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(IKey key, IAnnotation annotation)
- {
- Check.NotNull(key, nameof(key));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -555,12 +507,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(IProperty property, IAnnotation annotation)
- {
- Check.NotNull(property, nameof(property));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -573,12 +520,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(IForeignKey foreignKey, IAnnotation annotation)
- {
- Check.NotNull(foreignKey, nameof(foreignKey));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -591,12 +533,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(INavigation navigation, IAnnotation annotation)
- {
- Check.NotNull(navigation, nameof(navigation));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -609,12 +546,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(ISkipNavigation navigation, IAnnotation annotation)
- {
- Check.NotNull(navigation, nameof(navigation));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a fluent API call for the given , or
@@ -627,12 +559,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual MethodCallCodeFragment? GenerateFluentApi(IIndex index, IAnnotation annotation)
- {
- Check.NotNull(index, nameof(index));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a data annotation attribute code fragment for the given ,
@@ -645,12 +572,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual AttributeCodeFragment? GenerateDataAnnotation(IEntityType entityType, IAnnotation annotation)
- {
- Check.NotNull(entityType, nameof(entityType));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
///
/// Returns a data annotation attribute code fragment for the given ,
@@ -663,12 +585,7 @@ protected virtual bool IsHandledByConvention(IIndex index, IAnnotation annotatio
/// The .
/// .
protected virtual AttributeCodeFragment? GenerateDataAnnotation(IProperty property, IAnnotation annotation)
- {
- Check.NotNull(property, nameof(property));
- Check.NotNull(annotation, nameof(annotation));
-
- return null;
- }
+ => null;
private IEnumerable GenerateFluentApiCallsHelper(
TAnnotatable annotatable,
diff --git a/src/EFCore.Relational/Design/AnnotationCodeGeneratorDependencies.cs b/src/EFCore.Relational/Design/AnnotationCodeGeneratorDependencies.cs
index e3b3e7cb1ed..cae5d915c47 100644
--- a/src/EFCore.Relational/Design/AnnotationCodeGeneratorDependencies.cs
+++ b/src/EFCore.Relational/Design/AnnotationCodeGeneratorDependencies.cs
@@ -3,7 +3,6 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.EntityFrameworkCore.Utilities;
namespace Microsoft.EntityFrameworkCore.Design
{
@@ -44,8 +43,6 @@ public sealed record AnnotationCodeGeneratorDependencies
public AnnotationCodeGeneratorDependencies(
IRelationalTypeMappingSource relationalTypeMappingSource)
{
- Check.NotNull(relationalTypeMappingSource, nameof(relationalTypeMappingSource));
-
RelationalTypeMappingSource = relationalTypeMappingSource;
}
diff --git a/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs b/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs
index d393701771e..0c35106ffab 100644
--- a/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs
+++ b/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs
@@ -29,8 +29,6 @@ public RelationalCSharpRuntimeAnnotationCodeGenerator(
RelationalCSharpRuntimeAnnotationCodeGeneratorDependencies relationalDependencies)
: base(dependencies)
{
- Check.NotNull(relationalDependencies, nameof(relationalDependencies));
-
RelationalDependencies = relationalDependencies;
}
diff --git a/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs b/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs
index deedc5e965e..82548552e96 100644
--- a/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs
+++ b/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs
@@ -39,7 +39,7 @@ public static class RelationalDatabaseFacadeExtensions
///
/// The for the context.
public static void Migrate(this DatabaseFacade databaseFacade)
- => Check.NotNull(databaseFacade, nameof(databaseFacade)).GetRelationalService().Migrate();
+ => databaseFacade.GetRelationalService().Migrate();
///
/// Gets all the migrations that are defined in the configured migrations assembly.
@@ -50,7 +50,7 @@ public static void Migrate(this DatabaseFacade databaseFacade)
/// The for the context.
/// The list of migrations.
public static IEnumerable GetMigrations(this DatabaseFacade databaseFacade)
- => Check.NotNull(databaseFacade, nameof(databaseFacade)).GetRelationalService().Migrations.Keys;
+ => databaseFacade.GetRelationalService().Migrations.Keys;
///
/// Gets all migrations that have been applied to the target database.
@@ -61,7 +61,7 @@ public static IEnumerable GetMigrations(this DatabaseFacade databaseFaca
/// The for the context.
/// The list of migrations.
public static IEnumerable GetAppliedMigrations(this DatabaseFacade databaseFacade)
- => Check.NotNull(databaseFacade, nameof(databaseFacade)).GetRelationalService()
+ => databaseFacade.GetRelationalService()
.GetAppliedMigrations().Select(hr => hr.MigrationId);
///
@@ -77,7 +77,7 @@ public static IEnumerable GetAppliedMigrations(this DatabaseFacade datab
public static async Task> GetAppliedMigrationsAsync(
this DatabaseFacade databaseFacade,
CancellationToken cancellationToken = default)
- => (await Check.NotNull(databaseFacade, nameof(databaseFacade)).GetRelationalService()
+ => (await databaseFacade.GetRelationalService()
.GetAppliedMigrationsAsync(cancellationToken).ConfigureAwait(false)).Select(hr => hr.MigrationId);
///
@@ -128,7 +128,7 @@ public static async Task> GetPendingMigrationsAsync(
public static Task MigrateAsync(
this DatabaseFacade databaseFacade,
CancellationToken cancellationToken = default)
- => Check.NotNull(databaseFacade, nameof(databaseFacade)).GetRelationalService()
+ => databaseFacade.GetRelationalService()
.MigrateAsync(cancellationToken: cancellationToken);
///
@@ -252,7 +252,6 @@ public static int ExecuteSqlRaw(
string sql,
IEnumerable