Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ private static readonly MethodInfo IndexHasOperatorsMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasOperators), typeof(IndexBuilder), typeof(string[]));

private static readonly MethodInfo IndexHasSortOrderMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasSortOrder), typeof(IndexBuilder), typeof(SortOrder[]));

private static readonly MethodInfo IndexHasNullSortOrderMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasNullSortOrder), typeof(IndexBuilder), typeof(NullSortOrder[]));
Expand Down Expand Up @@ -423,8 +419,6 @@ public override IReadOnlyList<MethodCallCodeFragment> GenerateFluentApiCalls(
=> new MethodCallCodeFragment(IndexHasMethodMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexOperators
=> new MethodCallCodeFragment(IndexHasOperatorsMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexSortOrder
=> new MethodCallCodeFragment(IndexHasSortOrderMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexNullSortOrder
=> new MethodCallCodeFragment(IndexHasNullSortOrderMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexInclude
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,45 +294,4 @@ public static EntityTypeBuilder<TEntity> UseCockroachDbInterleaveInParent<TEntit
(EntityTypeBuilder)entityTypeBuilder, parentTableType, interleavePrefix);

#endregion CockroachDB Interleave-in-parent

#region Obsolete

/// <summary>
/// Configures using the auto-updating system column <c>xmin</c> as the optimistic concurrency token.
/// </summary>
/// <param name="entityTypeBuilder">The builder for the entity type being configured.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
/// <remarks>
/// See <see href="https://www.npgsql.org/efcore/modeling/concurrency.html">Concurrency tokens</see>
/// for more information on using optimistic concurrency in PostgreSQL.
/// </remarks>
[Obsolete("Use EF Core's standard IsRowVersion() or [Timestamp], see https://learn.microsoft.com/ef/core/saving/concurrency")]
public static EntityTypeBuilder UseXminAsConcurrencyToken(
this EntityTypeBuilder entityTypeBuilder)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));

entityTypeBuilder.Property<uint>("xmin")
.HasColumnType("xid")
.ValueGeneratedOnAddOrUpdate()
.IsConcurrencyToken();

return entityTypeBuilder;
}

/// <summary>
/// Configures using the auto-updating system column <c>xmin</c> as the optimistic concurrency token.
/// </summary>
/// <remarks>
/// See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens
/// </remarks>
/// <param name="entityTypeBuilder">The builder for the entity type being configured.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
[Obsolete("Use EF Core's standard IsRowVersion() or [Timestamp], see https://learn.microsoft.com/ef/core/saving/concurrency")]
public static EntityTypeBuilder<TEntity> UseXminAsConcurrencyToken<TEntity>(
this EntityTypeBuilder<TEntity> entityTypeBuilder)
where TEntity : class
=> (EntityTypeBuilder<TEntity>)UseXminAsConcurrencyToken((EntityTypeBuilder)entityTypeBuilder);

#endregion Obsolete
}
Original file line number Diff line number Diff line change
Expand Up @@ -847,281 +847,4 @@ public static bool CanSetStorageParameter(
}

#endregion Storage parameters

#region Sort order (legacy)

/// <summary>
/// The PostgreSQL index sort ordering to be used.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-ordering.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort order to use for each column.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use IsDescending instead")]
public static IndexBuilder HasSortOrder(
this IndexBuilder indexBuilder,
params SortOrder[]? values)
{
Check.NotNull(indexBuilder, nameof(indexBuilder));
Check.NullButNotEmpty(values, nameof(values));

var isDescending = new bool[indexBuilder.Metadata.Properties.Count];

for (var i = 0; i < isDescending.Length; i++)
{
isDescending[i] = values?.Length > i && values[i] == SortOrder.Descending;
}

indexBuilder.IsDescending(isDescending);

return indexBuilder;
}

/// <summary>
/// The PostgreSQL index sort ordering to be used.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-ordering.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort order to use for each column.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use IsDescending instead")]
public static IndexBuilder<TEntity> HasSortOrder<TEntity>(
this IndexBuilder<TEntity> indexBuilder,
params SortOrder[]? values)
=> (IndexBuilder<TEntity>)HasSortOrder((IndexBuilder)indexBuilder, values);

/// <summary>
/// The PostgreSQL index sort ordering to be used.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-ordering.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <param name="values">The sort order to use for each column.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use IsDescending instead")]
public static IConventionIndexBuilder? HasSortOrder(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<SortOrder>? values,
bool fromDataAnnotation)
{
if (indexBuilder.CanSetSortOrder(values, fromDataAnnotation))
{
Check.NotNull(indexBuilder, nameof(indexBuilder));
Check.NullButNotEmpty(values, nameof(values));

var isDescending = new bool[indexBuilder.Metadata.Properties.Count];

for (var i = 0; i < isDescending.Length; i++)
{
isDescending[i] = values?.Count > i && values[i] == SortOrder.Descending;
}

indexBuilder.IsDescending(isDescending);

return indexBuilder;
}

return null;
}

/// <summary>
/// Returns a value indicating whether the PostgreSQL index sort ordering can be set.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-ordering.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort order to use for each column.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use IsDescending instead")]
public static bool CanSetSortOrder(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<SortOrder>? values,
bool fromDataAnnotation)
{
Check.NotNull(indexBuilder, nameof(indexBuilder));

return indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexSortOrder, values, fromDataAnnotation);
}

#endregion Sort order (obsolete)

#region Obsolete

/// <summary>
/// The PostgreSQL index collation to be used.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-collations.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort options to use for each column.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use UseCollation")]
public static IndexBuilder HasCollation(
this IndexBuilder indexBuilder,
params string[]? values)
=> UseCollation(indexBuilder, values);

/// <summary>
/// The PostgreSQL index collation to be used.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-collations.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort options to use for each column.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use UseCollation")]
public static IndexBuilder<TEntity> HasCollation<TEntity>(
this IndexBuilder<TEntity> indexBuilder,
params string[]? values)
=> UseCollation(indexBuilder, values);

/// <summary>
/// The PostgreSQL index collation to be used.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-collations.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort options to use for each column.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use UseCollation")]
public static IConventionIndexBuilder? HasCollation(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<string>? values,
bool fromDataAnnotation)
=> UseCollation(indexBuilder, values, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the PostgreSQL index collation can be set.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-collations.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort options to use for each column.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use CanSetHasCollation")]
public static bool CanSetHasCollation(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<string>? values,
bool fromDataAnnotation)
=> CanSetCollation(indexBuilder, values, fromDataAnnotation);

/// <summary>
/// The PostgreSQL index method to be used. Null selects the default (currently btree).
/// </summary>
/// <remarks>
/// http://www.postgresql.org/docs/current/static/sql-createindex.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="method">The name of the index.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns><c>true</c> if the index can be configured with the method</returns>
[Obsolete("Use CanSetMethod")]
public static bool CanSetHasMethod(
this IConventionIndexBuilder indexBuilder,
string? method,
bool fromDataAnnotation = false)
=> CanSetMethod(indexBuilder, method, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the PostgreSQL index operators can be set.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-opclass.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="operators">The operators to use for each column.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns><c>true</c> if the index can be configured with the method.</returns>
[Obsolete("Use CanSetOperators")]
public static bool CanSetHasOperators(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<string>? operators,
bool fromDataAnnotation)
=> CanSetOperators(indexBuilder, operators, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the index can be configured as a full-text tsvector expression index.
/// </summary>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="config">
/// <para>
/// The text search configuration for this generated tsvector property, or <c>null</c> if this is not a
/// generated tsvector property.
/// </para>
/// <para>
/// See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
/// </para>
/// </param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns><c>true</c> if the index can be configured as a full-text tsvector expression index.</returns>
[Obsolete("Use CanSetIsTsVectorExpressionIndex")]
public static bool CanSetToTsVector(
this IConventionIndexBuilder indexBuilder,
string? config,
bool fromDataAnnotation = false)
=> CanSetIsTsVectorExpressionIndex(indexBuilder, config, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the PostgreSQL index sort ordering can be set.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-ordering.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort order to use for each column.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use CanSetSortOrder")]
public static bool CanSetHasSortOrder(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<SortOrder>? values,
bool fromDataAnnotation)
=> CanSetSortOrder(indexBuilder, values, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the PostgreSQL index null sort ordering can be set.
/// </summary>
/// <remarks>
/// https://www.postgresql.org/docs/current/static/indexes-ordering.html
/// </remarks>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="values">The sort order to use for each column.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns>A builder to further configure the index.</returns>
[Obsolete("Use CanSetNullSortOrder")]
public static bool CanSetHasNullSortOrder(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<NullSortOrder>? values,
bool fromDataAnnotation)
=> CanSetNullSortOrder(indexBuilder, values, fromDataAnnotation);

/// <summary>
/// Returns a value indicating whether the given include properties can be set.
/// </summary>
/// <param name="indexBuilder">The builder for the index being configured.</param>
/// <param name="propertyNames">An array of property names to be used in 'include' clause.</param>
/// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
/// <returns> <c>true</c> if the given include properties can be set. </returns>
[Obsolete("Use CanSetIncludeProperties")]
public static bool CanSetInclude(
this IConventionIndexBuilder indexBuilder,
IReadOnlyList<string>? propertyNames,
bool fromDataAnnotation = false)
=> CanSetIncludeProperties(indexBuilder, propertyNames, fromDataAnnotation);

#endregion Obsolete
}
Loading