diff --git a/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs b/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs index ae5435a603c..f1eab6589f3 100644 --- a/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs +++ b/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs @@ -805,7 +805,7 @@ protected virtual void GenerateEntityTypeAnnotations( if (((bool?)isExcludedAnnotation.Value) == true) { stringBuilder - .Append(", t => t.IsExcludedFromMigrations()"); + .Append(", t => t.ExcludeFromMigrations()"); } annotations.Remove(isExcludedAnnotation.Name); } diff --git a/src/EFCore.Relational/Metadata/Builders/TableBuilder.cs b/src/EFCore.Relational/Metadata/Builders/TableBuilder.cs index 66ac541922a..4bd8fdcf2ef 100644 --- a/src/EFCore.Relational/Metadata/Builders/TableBuilder.cs +++ b/src/EFCore.Relational/Metadata/Builders/TableBuilder.cs @@ -35,7 +35,7 @@ public TableBuilder([NotNull] string name, [CanBeNull] string schema, [NotNull] /// /// A value indicating whether the table should be managed by migrations. /// The same builder instance so that multiple calls can be chained. - public virtual TableBuilder IsExcludedFromMigrations(bool excluded = true) + public virtual TableBuilder ExcludeFromMigrations(bool excluded = true) { EntityType.SetIsTableExcludedFromMigrations(excluded); return this; diff --git a/src/EFCore.Relational/Metadata/Builders/TableBuilder`.cs b/src/EFCore.Relational/Metadata/Builders/TableBuilder`.cs index 1a633a52295..3abfff21e74 100644 --- a/src/EFCore.Relational/Metadata/Builders/TableBuilder`.cs +++ b/src/EFCore.Relational/Metadata/Builders/TableBuilder`.cs @@ -33,7 +33,7 @@ public TableBuilder([NotNull] string name, [CanBeNull] string schema, [NotNull] /// /// A value indicating whether the table should be managed by migrations. /// The same builder instance so that multiple calls can be chained. - public new virtual TableBuilder IsExcludedFromMigrations(bool excluded = true) - => (TableBuilder)base.IsExcludedFromMigrations(excluded); + public new virtual TableBuilder ExcludeFromMigrations(bool excluded = true) + => (TableBuilder)base.ExcludeFromMigrations(excluded); } } diff --git a/src/EFCore/Metadata/Builders/IConventionEntityTypeBuilder.cs b/src/EFCore/Metadata/Builders/IConventionEntityTypeBuilder.cs index 29c197a565d..36357192663 100644 --- a/src/EFCore/Metadata/Builders/IConventionEntityTypeBuilder.cs +++ b/src/EFCore/Metadata/Builders/IConventionEntityTypeBuilder.cs @@ -399,7 +399,7 @@ IConventionForeignKeyBuilder HasRelationship( /// Configures a relationship between this and the target entity type. /// /// The entity type that this relationship targets. - /// + /// /// The name of the navigation property on this entity type that is part of the relationship. /// /// A value indicating whether the target entity type should be configured as the principal end. @@ -410,7 +410,7 @@ IConventionForeignKeyBuilder HasRelationship( /// IConventionForeignKeyBuilder HasRelationship( [NotNull] IConventionEntityType targetEntityType, - [NotNull] string navigationToTargetName, + [NotNull] string navigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false); @@ -418,7 +418,7 @@ IConventionForeignKeyBuilder HasRelationship( /// Configures a relationship between this and the target entity type. /// /// The entity type that this relationship targets. - /// The navigation property on this entity type that is part of the relationship. + /// The navigation property on this entity type that is part of the relationship. /// A value indicating whether the target entity type should be configured as the principal end. /// Indicates whether the configuration was specified using a data annotation. /// @@ -427,7 +427,7 @@ IConventionForeignKeyBuilder HasRelationship( /// IConventionForeignKeyBuilder HasRelationship( [NotNull] IConventionEntityType targetEntityType, - [NotNull] MemberInfo navigationToTarget, + [NotNull] MemberInfo navigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false); @@ -435,7 +435,7 @@ IConventionForeignKeyBuilder HasRelationship( /// Configures a relationship between this and the target entity type. /// /// The entity type that this relationship targets. - /// The name of the navigation property on this entity type that is part of the relationship. + /// The name of the navigation property on this entity type that is part of the relationship. /// /// The name of the navigation property on the target entity type that is part of the relationship. If /// is specified, the relationship will be configured without a navigation property on the target end. @@ -448,7 +448,7 @@ IConventionForeignKeyBuilder HasRelationship( /// IConventionForeignKeyBuilder HasRelationship( [NotNull] IConventionEntityType targetEntityType, - [NotNull] string navigationToTargetName, + [NotNull] string navigationName, [CanBeNull] string inverseNavigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false); @@ -457,7 +457,7 @@ IConventionForeignKeyBuilder HasRelationship( /// Configures a relationship between this and the target entity type. /// /// The entity type that this relationship targets. - /// The navigation property on this entity type that is part of the relationship. + /// The navigation property on this entity type that is part of the relationship. /// /// The navigation property on the target entity type that is part of the relationship. If /// is specified, the relationship will be configured without a navigation property on the target end. @@ -470,7 +470,7 @@ IConventionForeignKeyBuilder HasRelationship( /// IConventionForeignKeyBuilder HasRelationship( [NotNull] IConventionEntityType targetEntityType, - [NotNull] MemberInfo navigationToTarget, + [NotNull] MemberInfo navigation, [CanBeNull] MemberInfo inverseNavigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false); @@ -479,19 +479,19 @@ IConventionForeignKeyBuilder HasRelationship( /// Configures a relationship where the target entity is owned by (or part of) this entity. /// /// The type that this relationship targets. - /// The name of the navigation property on this entity type that is part of the relationship. + /// The name of the navigation property on this entity type that is part of the relationship. /// Indicates whether the configuration was specified using a data annotation. /// An object that can be used to configure the relationship. IConventionForeignKeyBuilder HasOwnership( [NotNull] Type targetEntityType, - [NotNull] string navigationToTargetName, + [NotNull] string navigationName, bool fromDataAnnotation = false); /// /// Configures a relationship where the target entity is owned by (or part of) this entity. /// /// The type that this relationship targets. - /// The navigation property on this entity type that is part of the relationship. + /// The navigation property on this entity type that is part of the relationship. /// Indicates whether the configuration was specified using a data annotation. /// /// An object that can be used to configure the relationship if it exists on the entity type, @@ -499,14 +499,14 @@ IConventionForeignKeyBuilder HasOwnership( /// IConventionForeignKeyBuilder HasOwnership( [NotNull] Type targetEntityType, - [NotNull] MemberInfo navigationToTarget, + [NotNull] MemberInfo navigation, bool fromDataAnnotation = false); /// /// Configures a relationship where the target entity is owned by (or part of) this entity. /// /// The type that this relationship targets. - /// The name of the navigation property on this entity type that is part of the relationship. + /// The name of the navigation property on this entity type that is part of the relationship. /// /// The name of the navigation property on the target entity type that is part of the relationship. If /// is specified, the relationship will be configured without a navigation property on the target end. @@ -518,7 +518,7 @@ IConventionForeignKeyBuilder HasOwnership( /// IConventionForeignKeyBuilder HasOwnership( [NotNull] Type targetEntityType, - [NotNull] string navigationToTargetName, + [NotNull] string navigationName, [CanBeNull] string inverseNavigationName, bool fromDataAnnotation = false); @@ -526,7 +526,7 @@ IConventionForeignKeyBuilder HasOwnership( /// Configures a relationship where the target entity is owned by (or part of) this entity. /// /// The type that this relationship targets. - /// The navigation property on this entity type that is part of the relationship. + /// The navigation property on this entity type that is part of the relationship. /// /// The navigation property on the target entity type that is part of the relationship. If /// is specified, the relationship will be configured without a navigation property on the target end. @@ -538,7 +538,7 @@ IConventionForeignKeyBuilder HasOwnership( /// IConventionForeignKeyBuilder HasOwnership( [NotNull] Type targetEntityType, - [NotNull] MemberInfo navigationToTarget, + [NotNull] MemberInfo navigation, [CanBeNull] MemberInfo inverseNavigation, bool fromDataAnnotation = false); @@ -631,7 +631,7 @@ bool CanAddNavigation([NotNull] string navigationName, bool fromDataAnnotation = /// Configures a skip navigation and the inverse between this and the target entity type. /// /// The entity type that this relationship targets. - /// The navigation property on this entity type that is part of the relationship. + /// The navigation property on this entity type that is part of the relationship. /// /// The navigation property on the target entity type that is part of the relationship. If /// is specified, the relationship will be configured without a navigation property on the target end. @@ -646,7 +646,7 @@ bool CanAddNavigation([NotNull] string navigationName, bool fromDataAnnotation = /// otherwise. /// IConventionSkipNavigationBuilder HasSkipNavigation( - [NotNull] MemberInfo navigationToTarget, + [NotNull] MemberInfo navigation, [NotNull] IConventionEntityType targetEntityType, [NotNull] MemberInfo inverseNavigation, bool? collections = null, @@ -656,7 +656,7 @@ IConventionSkipNavigationBuilder HasSkipNavigation( /// /// Configures a skip navigation between this and the target entity type. /// - /// The navigation property. + /// The navigation property. /// The entity type that the navigation targets. /// Whether the navigation property is a collection property. /// @@ -668,7 +668,7 @@ IConventionSkipNavigationBuilder HasSkipNavigation( /// otherwise. /// IConventionSkipNavigationBuilder HasSkipNavigation( - [NotNull] MemberInfo navigationToTarget, + [NotNull] MemberInfo navigation, [NotNull] IConventionEntityType targetEntityType, bool? collection = null, bool? onDependent = null, diff --git a/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs b/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs index 117b3932c92..609f575bd80 100644 --- a/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs +++ b/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs @@ -2599,13 +2599,13 @@ public virtual InternalForeignKeyBuilder HasRelationship( /// public virtual InternalForeignKeyBuilder HasRelationship( [NotNull] EntityType targetEntityType, - [CanBeNull] string navigationToTargetName, + [CanBeNull] string navigationName, [CanBeNull] string inverseNavigationName, ConfigurationSource configurationSource, bool setTargetAsPrincipal = false) => HasRelationship( Check.NotNull(targetEntityType, nameof(targetEntityType)), - MemberIdentity.Create(navigationToTargetName), + MemberIdentity.Create(navigationName), MemberIdentity.Create(inverseNavigationName), setTargetAsPrincipal ? true : (bool?)null, configurationSource); @@ -2618,13 +2618,13 @@ public virtual InternalForeignKeyBuilder HasRelationship( /// public virtual InternalForeignKeyBuilder HasRelationship( [NotNull] EntityType targetEntityType, - [CanBeNull] MemberInfo navigationToTarget, + [CanBeNull] MemberInfo navigation, [CanBeNull] MemberInfo inverseNavigation, ConfigurationSource configurationSource, bool setTargetAsPrincipal = false) => HasRelationship( Check.NotNull(targetEntityType, nameof(targetEntityType)), - MemberIdentity.Create(navigationToTarget), + MemberIdentity.Create(navigation), MemberIdentity.Create(inverseNavigation), setTargetAsPrincipal ? true : (bool?)null, configurationSource); @@ -3563,7 +3563,7 @@ private ForeignKey SetOrAddForeignKey( /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual InternalSkipNavigationBuilder HasSkipNavigation( - MemberIdentity navigationToTarget, + MemberIdentity navigation, [NotNull] EntityType targetEntityType, MemberIdentity inverseNavigation, ConfigurationSource configurationSource, @@ -3571,7 +3571,7 @@ public virtual InternalSkipNavigationBuilder HasSkipNavigation( bool? onDependent = null) { var skipNavigationBuilder = HasSkipNavigation( - navigationToTarget, targetEntityType, configurationSource, collections, onDependent); + navigation, targetEntityType, configurationSource, collections, onDependent); if (skipNavigationBuilder == null) { return null; @@ -4720,10 +4720,10 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( /// [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( - IConventionEntityType targetEntityType, string navigationToTargetName, bool setTargetAsPrincipal, bool fromDataAnnotation) + IConventionEntityType targetEntityType, string navigationName, bool setTargetAsPrincipal, bool fromDataAnnotation) => HasRelationship( (EntityType)targetEntityType, - navigationToTargetName, + navigationName, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention, setTargetAsPrincipal ? true : (bool?)null); @@ -4735,10 +4735,10 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( /// [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( - IConventionEntityType targetEntityType, MemberInfo navigationToTarget, bool setTargetAsPrincipal, bool fromDataAnnotation) + IConventionEntityType targetEntityType, MemberInfo navigation, bool setTargetAsPrincipal, bool fromDataAnnotation) => HasRelationship( (EntityType)targetEntityType, - navigationToTarget, + navigation, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention, setTargetAsPrincipal ? true : (bool?)null); @@ -4751,13 +4751,13 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( IConventionEntityType targetEntityType, - string navigationToTargetName, + string navigationName, string inverseNavigationName, bool setTargetAsPrincipal, bool fromDataAnnotation) => HasRelationship( (EntityType)targetEntityType, - navigationToTargetName, inverseNavigationName, + navigationName, inverseNavigationName, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention, setTargetAsPrincipal); @@ -4770,27 +4770,27 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasRelationship( IConventionEntityType targetEntityType, - MemberInfo navigationToTarget, + MemberInfo navigation, MemberInfo inverseNavigation, bool setTargetAsPrincipal, bool fromDataAnnotation) => HasRelationship( (EntityType)targetEntityType, - navigationToTarget, inverseNavigation, + navigation, inverseNavigation, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention, setTargetAsPrincipal); /// [DebuggerStepThrough] IConventionSkipNavigationBuilder IConventionEntityTypeBuilder.HasSkipNavigation( - MemberInfo navigationToTarget, + MemberInfo navigation, IConventionEntityType targetEntityType, MemberInfo inverseNavigation, bool? collections, bool? onDependent, bool fromDataAnnotation) => HasSkipNavigation( - MemberIdentity.Create(navigationToTarget), + MemberIdentity.Create(navigation), (EntityType)targetEntityType, MemberIdentity.Create(inverseNavigation), fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention, @@ -4805,9 +4805,9 @@ IConventionSkipNavigationBuilder IConventionEntityTypeBuilder.HasSkipNavigation( /// [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( - Type targetEntityType, string navigationToTargetName, bool fromDataAnnotation) + Type targetEntityType, string navigationName, bool fromDataAnnotation) => HasOwnership( - targetEntityType, navigationToTargetName, + targetEntityType, navigationName, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); /// @@ -4818,9 +4818,9 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( /// [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( - Type targetEntityType, MemberInfo navigationToTarget, bool fromDataAnnotation) + Type targetEntityType, MemberInfo navigation, bool fromDataAnnotation) => HasOwnership( - targetEntityType, navigationToTarget, + targetEntityType, navigation, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); /// @@ -4831,9 +4831,9 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( /// [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( - Type targetEntityType, string navigationToTargetName, string inversePropertyName, bool fromDataAnnotation) + Type targetEntityType, string navigationName, string inversePropertyName, bool fromDataAnnotation) => HasOwnership( - targetEntityType, navigationToTargetName, inversePropertyName, + targetEntityType, navigationName, inversePropertyName, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); /// @@ -4844,9 +4844,9 @@ IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( /// [DebuggerStepThrough] IConventionForeignKeyBuilder IConventionEntityTypeBuilder.HasOwnership( - Type targetEntityType, MemberInfo navigationToTarget, MemberInfo inverseProperty, bool fromDataAnnotation) + Type targetEntityType, MemberInfo navigation, MemberInfo inverseProperty, bool fromDataAnnotation) => HasOwnership( - targetEntityType, navigationToTarget, inverseProperty, + targetEntityType, navigation, inverseProperty, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); /// @@ -4923,13 +4923,13 @@ bool IConventionEntityTypeBuilder.CanHaveNavigationBase(string navigationBaseNam /// [DebuggerStepThrough] IConventionSkipNavigationBuilder IConventionEntityTypeBuilder.HasSkipNavigation( - MemberInfo navigationToTarget, + MemberInfo navigation, IConventionEntityType targetEntityType, bool? collection, bool? onDependent, bool fromDataAnnotation) => HasSkipNavigation( - MemberIdentity.Create(navigationToTarget), + MemberIdentity.Create(navigation), (EntityType)targetEntityType, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention, collection, diff --git a/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs b/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs index 74f1532581b..317608b18cb 100644 --- a/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs +++ b/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs @@ -433,7 +433,7 @@ public virtual void Entities_are_stored_in_model_snapshot_for_TPT_with_one_exclu builder => { builder.Entity() - .ToTable("DerivedEntity", "foo", t => t.IsExcludedFromMigrations()); + .ToTable("DerivedEntity", "foo", t => t.ExcludeFromMigrations()); builder.Entity(); }, AddBoilerPlate( @@ -461,7 +461,7 @@ public virtual void Entities_are_stored_in_model_snapshot_for_TPT_with_one_exclu b.Property(""Name"") .HasColumnType(""nvarchar(max)""); - b.ToTable(""DerivedEntity"", ""foo"", t => t.IsExcludedFromMigrations()); + b.ToTable(""DerivedEntity"", ""foo"", t => t.ExcludeFromMigrations()); });"), o => { diff --git a/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs b/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs index 5e8cbe68fa4..540fbb853d7 100644 --- a/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs +++ b/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs @@ -411,8 +411,8 @@ public virtual void Passes_for_compatible_excluded_shared_table_inverted() var modelBuilder = CreateConventionalModelBuilder(); modelBuilder.Entity().HasOne().WithOne().HasPrincipalKey(a => a.Id).HasForeignKey(b => b.Id).IsRequired(); - modelBuilder.Entity().ToTable("Table", t => t.IsExcludedFromMigrations()); - modelBuilder.Entity().ToTable("Table", t => t.IsExcludedFromMigrations()); + modelBuilder.Entity().ToTable("Table", t => t.ExcludeFromMigrations()); + modelBuilder.Entity().ToTable("Table", t => t.ExcludeFromMigrations()); Validate(modelBuilder.Model); } @@ -423,7 +423,7 @@ public virtual void Passes_for_compatible_excluded_shared_table_owned() var modelBuilder = CreateConventionalModelBuilder(); modelBuilder.Entity().OwnsOne(b => b.A); - modelBuilder.Entity().ToTable("Table", t => t.IsExcludedFromMigrations()); + modelBuilder.Entity().ToTable("Table", t => t.ExcludeFromMigrations()); var model = Validate(modelBuilder.Model); @@ -437,7 +437,7 @@ public virtual void Passes_for_compatible_excluded_table_derived() { var modelBuilder = CreateConventionalModelBuilder(); - modelBuilder.Entity().ToTable("Table", t => t.IsExcludedFromMigrations()); + modelBuilder.Entity().ToTable("Table", t => t.ExcludeFromMigrations()); modelBuilder.Entity(); var model = Validate(modelBuilder.Model); @@ -453,7 +453,7 @@ public virtual void Detect_partially_excluded_shared_table() var modelBuilder = CreateConventionalModelBuilder(); modelBuilder.Entity().HasOne().WithOne().HasPrincipalKey(a => a.Id).HasForeignKey(b => b.Id).IsRequired(); - modelBuilder.Entity().ToTable("Table", t => t.IsExcludedFromMigrations()); + modelBuilder.Entity().ToTable("Table", t => t.ExcludeFromMigrations()); modelBuilder.Entity().ToTable("Table"); VerifyError(