Skip to content

Commit

Permalink
Metadata: Remove obsoleted code (#26740)
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Nov 18, 2021
1 parent 93dbd42 commit e451959
Show file tree
Hide file tree
Showing 88 changed files with 44 additions and 2,508 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ protected override Expression VisitMember(MemberExpression memberExpression)
Expression.Convert(objectArrayProjectionExpression.InnerProjection, typeof(object)), typeof(ValueBuffer)),
nullable: true);

#pragma warning disable CS0618 // Type or member is obsolete
return new CollectionShaperExpression(
#pragma warning restore CS0618 // Type or member is obsolete
objectArrayProjectionExpression,
innerShaperExpression,
navigation,
Expand Down Expand Up @@ -558,9 +556,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
Expression.Convert(objectArrayProjectionExpression.InnerProjection, typeof(object)), typeof(ValueBuffer)),
nullable: true);

#pragma warning disable CS0618 // Type or member is obsolete
return new CollectionShaperExpression(
#pragma warning restore CS0618 // Type or member is obsolete
objectArrayProjectionExpression,
innerShaperExpression,
navigation,
Expand Down Expand Up @@ -589,9 +585,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp

case nameof(Queryable.Select)
when genericMethod == QueryableMethods.Select:
#pragma warning disable CS0618 // Type or member is obsolete
if (!(visitedSource is CollectionShaperExpression shaper))
#pragma warning restore CS0618 // Type or member is obsolete
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
projectionBindingExpression.Type, (projection.Expression as SqlExpression)?.TypeMapping);
}

#pragma warning disable CS0618 // Type or member is obsolete
case CollectionShaperExpression collectionShaperExpression:
#pragma warning restore CS0618 // Type or member is obsolete
{
ObjectArrayProjectionExpression objectArrayProjection;
switch (collectionShaperExpression.Projection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
expressions);
}

#pragma warning disable CS0618 // Type or member is obsolete
case CollectionShaperExpression collectionShaperExpression:
#pragma warning restore CS0618 // Type or member is obsolete
{
_currentEntityIndex++;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,23 +314,6 @@ public static OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> ToTable<TOwne
return referenceOwnershipBuilder;
}

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information.
/// </remarks>
/// <param name="referenceOwnershipBuilder">The builder for the entity type being configured.</param>
/// <param name="name">The name of the table.</param>
/// <param name="excludedFromMigrations">A value indicating whether the table should be managed by migrations.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
[Obsolete("Use the overload with an Action parameter")]
public static OwnedNavigationBuilder ToTable(
this OwnedNavigationBuilder referenceOwnershipBuilder,
string? name,
bool excludedFromMigrations)
=> referenceOwnershipBuilder.ToTable(name, null, excludedFromMigrations);

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
Expand Down Expand Up @@ -372,26 +355,6 @@ public static OwnedNavigationBuilder ToTable(
return referenceOwnershipBuilder;
}

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information.
/// </remarks>
/// <param name="referenceOwnershipBuilder">The builder for the entity type being configured.</param>
/// <param name="name">The name of the table.</param>
/// <param name="excludedFromMigrations">A value indicating whether the table should be managed by migrations.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
[Obsolete("Use the overload with an Action parameter")]
public static OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> ToTable<TOwnerEntity, TRelatedEntity>(
this OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> referenceOwnershipBuilder,
string? name,
bool excludedFromMigrations)
where TOwnerEntity : class
where TRelatedEntity : class
=> (OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity>)ToTable(
(OwnedNavigationBuilder)referenceOwnershipBuilder, name, excludedFromMigrations);

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
Expand Down Expand Up @@ -443,30 +406,6 @@ public static OwnedNavigationBuilder ToTable(
return referenceOwnershipBuilder;
}

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information.
/// </remarks>
/// <param name="referenceOwnershipBuilder">The builder for the entity type being configured.</param>
/// <param name="name">The name of the table.</param>
/// <param name="schema">The schema of the table.</param>
/// <param name="excludedFromMigrations">A value indicating whether the table should be managed by migrations.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
[Obsolete("Use the overload with an Action parameter")]
public static OwnedNavigationBuilder ToTable(
this OwnedNavigationBuilder referenceOwnershipBuilder,
string? name,
string? schema,
bool excludedFromMigrations)
{
Check.NullButNotEmpty(name, nameof(name));
Check.NullButNotEmpty(schema, nameof(schema));

return ToTable(referenceOwnershipBuilder, name, schema, (bool?)excludedFromMigrations);
}

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
Expand Down Expand Up @@ -514,28 +453,6 @@ public static OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> ToTable<TOwne
=> (OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity>)((OwnedNavigationBuilder)referenceOwnershipBuilder).ToTable(
name, schema);

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information.
/// </remarks>
/// <param name="referenceOwnershipBuilder">The builder for the entity type being configured.</param>
/// <param name="name">The name of the table.</param>
/// <param name="schema">The schema of the table.</param>
/// <param name="excludedFromMigrations">A value indicating whether the table should be managed by migrations.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
[Obsolete("Use the overload with an Action parameter")]
public static OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> ToTable<TOwnerEntity, TRelatedEntity>(
this OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> referenceOwnershipBuilder,
string? name,
string? schema,
bool excludedFromMigrations)
where TOwnerEntity : class
where TRelatedEntity : class
=> (OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity>)ToTable(
(OwnedNavigationBuilder)referenceOwnershipBuilder, name, schema, excludedFromMigrations);

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
Expand Down Expand Up @@ -566,24 +483,6 @@ public static OwnedNavigationBuilder<TOwnerEntity, TRelatedEntity> ToTable<TOwne
return referenceOwnershipBuilder;
}

[Obsolete]
private static OwnedNavigationBuilder ToTable(
OwnedNavigationBuilder referenceOwnershipBuilder,
string? name,
string? schema,
bool? excludedFromMigrations)
{
referenceOwnershipBuilder.OwnedEntityType.SetTableName(name);
referenceOwnershipBuilder.OwnedEntityType.SetSchema(schema);

if (excludedFromMigrations.HasValue)
{
referenceOwnershipBuilder.OwnedEntityType.SetIsTableExcludedFromMigrations(excludedFromMigrations.Value);
}

return referenceOwnershipBuilder;
}

/// <summary>
/// Configures the table that the entity type maps to when targeting a relational database.
/// </summary>
Expand Down Expand Up @@ -1779,25 +1678,6 @@ public static OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> HasCheckCon
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention)
?.Builder;

/// <summary>
/// Returns a value indicating whether the check constraint can be configured.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-check-constraints">Database check constraints</see> for more information.
/// </remarks>
/// <param name="entityTypeBuilder">The builder for the entity type being configured.</param>
/// <param name="name">The name of the check constraint.</param>
/// <param name="sql">The logical constraint sql used in the check constraint.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns><see langword="true" /> if the configuration can be applied.</returns>
[Obsolete("Use CanHaveCheckConstraint")]
public static bool CanSetCheckConstraint(
this IConventionEntityTypeBuilder entityTypeBuilder,
string name,
string? sql,
bool fromDataAnnotation = false)
=> entityTypeBuilder.CanHaveCheckConstraint(name, sql, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the check constraint can be configured.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public static IndexBuilder HasDatabaseName(this IndexBuilder indexBuilder, strin
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="name">The name of the index.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use HasDatabaseName() instead.")]
[Obsolete("Use HasDatabaseName() instead.")] // DO NOT REMOVE
// Used in model snapshot. See issue#18557
public static IndexBuilder HasName(this IndexBuilder indexBuilder, string? name)
=> HasDatabaseName(indexBuilder, name);

Expand All @@ -65,20 +66,6 @@ public static IndexBuilder<TEntity> HasDatabaseName<TEntity>(
return indexBuilder;
}

/// <summary>
/// Configures the name of the index in the database when targeting a relational database.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-indexes">Indexes</see> for more information.
/// </remarks>
/// <typeparam name="TEntity">The entity type being configured.</typeparam>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="name">The name of the index.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use HasDatabaseName() instead.")]
public static IndexBuilder<TEntity> HasName<TEntity>(this IndexBuilder<TEntity> indexBuilder, string? name)
=> indexBuilder.HasDatabaseName(name);

/// <summary>
/// Configures the name of the index in the database when targeting a relational database.
/// </summary>
Expand Down Expand Up @@ -106,26 +93,6 @@ public static IndexBuilder<TEntity> HasName<TEntity>(this IndexBuilder<TEntity>
return null;
}

/// <summary>
/// Configures the name of the index in the database when targeting a relational database.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-indexes">Indexes</see> for more information.
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="name">The name of the index.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns>
/// The same builder instance if the configuration was applied,
/// <see langword="null" /> otherwise.
/// </returns>
[Obsolete("Use HasDatabaseName() instead.")]
public static IConventionIndexBuilder? HasName(
this IConventionIndexBuilder indexBuilder,
string? name,
bool fromDataAnnotation = false)
=> indexBuilder.HasDatabaseName(name, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the given name can be set for the index.
/// </summary>
Expand All @@ -142,23 +109,6 @@ public static bool CanSetDatabaseName(
bool fromDataAnnotation = false)
=> indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Name, name, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the given name can be set for the index.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-indexes">Indexes</see> for more information.
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="name">The name of the index.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns><see langword="true" /> if the given name can be set for the index.</returns>
[Obsolete("Use CanSetDatabaseName() instead.")]
public static bool CanSetName(
this IConventionIndexBuilder indexBuilder,
string? name,
bool fromDataAnnotation = false)
=> CanSetDatabaseName(indexBuilder, name, fromDataAnnotation);

/// <summary>
/// Configures the filter expression for the index.
/// </summary>
Expand Down
46 changes: 0 additions & 46 deletions src/EFCore.Relational/Extensions/RelationalIndexExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ public static string GetDatabaseName(this IReadOnlyIndex index)
?? index.Name
?? index.GetDefaultDatabaseName();

/// <summary>
/// Returns the name of the index in the database.
/// </summary>
/// <param name="index">The index.</param>
/// <returns>The name of the index in the database.</returns>
[Obsolete("Use GetDatabaseName() instead")]
public static string GetName(this IIndex index)
=> GetDatabaseName(index);

/// <summary>
/// Returns the name of the index in the database.
/// </summary>
Expand Down Expand Up @@ -70,15 +61,6 @@ public static string GetDefaultDatabaseName(this IReadOnlyIndex index)
return Uniquifier.Truncate(baseName, index.DeclaringEntityType.Model.GetMaxIdentifierLength());
}

/// <summary>
/// Returns the default name that would be used for this index.
/// </summary>
/// <param name="index">The index.</param>
/// <returns>The default name that would be used for this index.</returns>
[Obsolete("Use GetDefaultDatabaseName() instead")]
public static string GetDefaultName(this IIndex index)
=> GetDefaultDatabaseName(index);

/// <summary>
/// Returns the default name that would be used for this index.
/// </summary>
Expand Down Expand Up @@ -148,15 +130,6 @@ public static void SetDatabaseName(this IMutableIndex index, string? name)
Check.NullButNotEmpty(name, nameof(name)));
}

/// <summary>
/// Sets the name of the index in the database.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="name">The value to set.</param>
[Obsolete("Use SetDatabaseName() instead.")]
public static void SetName(this IMutableIndex index, string? name)
=> SetDatabaseName(index, name);

/// <summary>
/// Sets the name of the index in the database.
/// </summary>
Expand All @@ -177,16 +150,6 @@ public static void SetName(this IMutableIndex index, string? name)
return name;
}

/// <summary>
/// Sets the name of the index in the database.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="name">The value to set.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
[Obsolete("Use SetDatabaseName() instead.")]
public static void SetName(this IConventionIndex index, string? name, bool fromDataAnnotation = false)
=> SetDatabaseName(index, name, fromDataAnnotation);

/// <summary>
/// Gets the <see cref="ConfigurationSource" /> for the name of the index in the database.
/// </summary>
Expand All @@ -195,15 +158,6 @@ public static void SetName(this IConventionIndex index, string? name, bool fromD
public static ConfigurationSource? GetDatabaseNameConfigurationSource(this IConventionIndex index)
=> index.FindAnnotation(RelationalAnnotationNames.Name)?.GetConfigurationSource();

/// <summary>
/// Gets the <see cref="ConfigurationSource" /> for the name of the index in the database.
/// </summary>
/// <param name="index">The index.</param>
/// <returns>The <see cref="ConfigurationSource" /> for the name of the index in the database.</returns>
[Obsolete("Use GetDatabaseNameConfigurationSource() instead.")]
public static ConfigurationSource? GetNameConfigurationSource(this IConventionIndex index)
=> GetDatabaseNameConfigurationSource(index);

/// <summary>
/// Returns the index filter expression.
/// </summary>
Expand Down
Loading

0 comments on commit e451959

Please sign in to comment.