/// <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> public static IndexBuilder HasSortOrder( this IndexBuilder indexBuilder, params SortOrder[]?values) { Check.NotNull(indexBuilder, nameof(indexBuilder)); Check.NullButNotEmpty(values, nameof(values)); if (!SortOrderHelper.IsDefaultSortOrder(values)) { indexBuilder.Metadata.SetSortOrder(values); } 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="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> 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)); if (!SortOrderHelper.IsDefaultSortOrder(values)) { indexBuilder.Metadata.SetSortOrder(values, fromDataAnnotation); } return(indexBuilder); } return(null); }