/// <summary> /// The PostgreSQL index NULL 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 HasNullSortOrder( this IndexBuilder indexBuilder, params NullSortOrder[]?values) { Check.NotNull(indexBuilder, nameof(indexBuilder)); Check.NullButNotEmpty(values, nameof(values)); if (!SortOrderHelper.IsDefaultNullSortOrder(values, indexBuilder.Metadata.IsDescending)) { indexBuilder.Metadata.SetNullSortOrder(values); } return(indexBuilder); }
/// <summary> /// The PostgreSQL index NULL 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 HasNullSortOrder( [NotNull] this IndexBuilder indexBuilder, [CanBeNull] params NullSortOrder[] values) { Check.NotNull(indexBuilder, nameof(indexBuilder)); Check.NullButNotEmpty(values, nameof(values)); var sortOrders = indexBuilder.Metadata.GetSortOrder(); if (!SortOrderHelper.IsDefaultNullSortOrder(values, sortOrders)) { indexBuilder.Metadata.SetNullSortOrder(values); } return(indexBuilder); }
/// <summary> /// The PostgreSQL index NULL 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> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns>A builder to further configure the index.</returns> public static IConventionIndexBuilder?HasNullSortOrder( this IConventionIndexBuilder indexBuilder, IReadOnlyList <NullSortOrder>?values, bool fromDataAnnotation) { if (indexBuilder.CanSetNullSortOrder(values, fromDataAnnotation)) { if (!SortOrderHelper.IsDefaultNullSortOrder(values, indexBuilder.Metadata.IsDescending)) { indexBuilder.Metadata.SetNullSortOrder(values, fromDataAnnotation); } return(indexBuilder); } return(null); }
/// <summary> /// The PostgreSQL index NULL 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> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns>A builder to further configure the index.</returns> public static IConventionIndexBuilder HasNullSortOrder( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] IReadOnlyList <NullSortOrder> values, bool fromDataAnnotation) { if (indexBuilder.CanSetNullSortOrder(values, fromDataAnnotation)) { var sortOrders = indexBuilder.Metadata.GetSortOrder(); if (!SortOrderHelper.IsDefaultNullSortOrder(values, sortOrders)) { indexBuilder.Metadata.SetNullSortOrder(values, fromDataAnnotation); } return(indexBuilder); } return(null); }