示例#1
0
        /// <summary>
        ///     Returns a value indicating whether the index can be configured with online option when targeting SQL Server.
        /// </summary>
        /// <param name="indexBuilder"> The builder for the index being configured. </param>
        /// <param name="createdOnline"> A value indicating whether the index is created with online option. </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,
        ///     <c>null</c> otherwise.
        /// </returns>
        /// <returns> <c>true</c> if the index can be configured with online option when targeting SQL Server. </returns>
        public static bool CanSetIsCreatedOnline(
            [NotNull] this IConventionIndexBuilder indexBuilder,
            bool?createdOnline,
            bool fromDataAnnotation = false)
        {
            Check.NotNull(indexBuilder, nameof(indexBuilder));

            return(indexBuilder.CanSetAnnotation(SqlServerAnnotationNames.CreatedOnline, createdOnline, fromDataAnnotation));
        }
示例#2
0
        /// <summary>
        ///     Returns a value indicating whether the index can be configured as clustered.
        /// </summary>
        /// <param name="indexBuilder"> The builder for the index being configured. </param>
        /// <param name="clustered"> A value indicating whether the index is clustered. </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 clustered. </returns>
        public static bool CanSetIsClustered(
            [NotNull] this IConventionIndexBuilder indexBuilder,
            bool?clustered,
            bool fromDataAnnotation = false)
        {
            Check.NotNull(indexBuilder, nameof(indexBuilder));

            return(indexBuilder.CanSetAnnotation(SqlServerAnnotationNames.Clustered, clustered, fromDataAnnotation));
        }
示例#3
0
    /// <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>
    public static bool CanSetMethod(
        this IConventionIndexBuilder indexBuilder,
        string?method,
        bool fromDataAnnotation = false)
    {
        Check.NotNull(indexBuilder, nameof(indexBuilder));

        return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexMethod, method, fromDataAnnotation));
    }
        /// <summary>
        ///     Returns a value indicating whether the index can be configured with fill factor option when targeting SQL Server.
        /// </summary>
        /// <param name="indexBuilder"> The builder for the index being configured. </param>
        /// <param name="fillFactor"> A value indicating whether the index is created with fill factor option. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        /// <returns> <see langword="true" /> if the index can be configured with fill factor option when targeting SQL Server. </returns>
        public static bool CanSetFillFactor(
            this IConventionIndexBuilder indexBuilder,
            int?fillFactor,
            bool fromDataAnnotation = false)
        {
            Check.NotNull(indexBuilder, nameof(indexBuilder));

            return(indexBuilder.CanSetAnnotation(SqlServerAnnotationNames.FillFactor, fillFactor, fromDataAnnotation));
        }
示例#5
0
    /// <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>
    public static bool CanSetNullSortOrder(
        this IConventionIndexBuilder indexBuilder,
        IReadOnlyList <NullSortOrder>?values,
        bool fromDataAnnotation)
    {
        Check.NotNull(indexBuilder, nameof(indexBuilder));

        return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexNullSortOrder, values, fromDataAnnotation));
    }
示例#6
0
    /// <summary>
    /// Returns a value indicating whether concurrent creation for the index can be set.
    /// </summary>
    /// <remarks>
    /// https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY
    /// </remarks>
    /// <param name="indexBuilder">The builder for the index being configured.</param>
    /// <param name="createdConcurrently">A value indicating whether the index is created with the "concurrently" option.</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 bool CanSetIsCreatedConcurrently(
        this IConventionIndexBuilder indexBuilder,
        bool?createdConcurrently,
        bool fromDataAnnotation = false)
    {
        Check.NotNull(indexBuilder, nameof(indexBuilder));

        return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.CreatedConcurrently, createdConcurrently, fromDataAnnotation));
    }
示例#7
0
    /// <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>
    public static bool CanSetIsTsVectorExpressionIndex(
        this IConventionIndexBuilder indexBuilder,
        string?config,
        bool fromDataAnnotation = false)
    {
        Check.NotNull(indexBuilder, nameof(indexBuilder));

        return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.TsVectorConfig, config, fromDataAnnotation));
    }
示例#8
0
    /// <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>
    public static bool CanSetCollation(
        this IConventionIndexBuilder indexBuilder,
        IReadOnlyList <string>?values,
        bool fromDataAnnotation)
    {
        Check.NotNull(indexBuilder, nameof(indexBuilder));

        return(indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Collation, values, fromDataAnnotation));
    }
示例#9
0
    /// <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>
    public static bool CanSetOperators(
        this IConventionIndexBuilder indexBuilder,
        IReadOnlyList <string>?operators,
        bool fromDataAnnotation)
    {
        Check.NotNull(indexBuilder, nameof(indexBuilder));

        return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexOperators, operators, fromDataAnnotation));
    }
示例#10
0
        /// <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>
        public static bool CanSetHasSortOrder(
            [NotNull] this IConventionIndexBuilder indexBuilder,
            [CanBeNull] IReadOnlyList <SortOrder> values,
            bool fromDataAnnotation)
        {
            Check.NotNull(indexBuilder, nameof(indexBuilder));

            return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexSortOrder, values, fromDataAnnotation));
        }
示例#11
0
        /// <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>
        public static bool CanSetHasCollation(
            [NotNull] this IConventionIndexBuilder indexBuilder,
            [CanBeNull, ItemNotNull] IReadOnlyList <string> values,
            bool fromDataAnnotation)
        {
            Check.NotNull(indexBuilder, nameof(indexBuilder));

            return(indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexCollation, values, fromDataAnnotation));
        }
 /// <summary>
 ///     Returns a value indicating whether the given expression can be set as the filter 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="sql">The filter expression for 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>
 public static bool CanSetFilter(
     this IConventionIndexBuilder indexBuilder,
     string?sql,
     bool fromDataAnnotation = false)
 => indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Filter, sql, 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>
 public static bool CanSetDatabaseName(
     this IConventionIndexBuilder indexBuilder,
     string?name,
     bool fromDataAnnotation = false)
 => indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Name, name, fromDataAnnotation);
 /// <summary>
 ///     Returns a value indicating whether the index can be configured as clustered.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see>, and
 ///     <see href="https://aka.ms/efcore-docs-sqlserver">Accessing SQL Server and SQL Azure databases with EF Core</see>
 ///     for more information and examples.
 /// </remarks>
 /// <param name="indexBuilder">The builder for the index being configured.</param>
 /// <param name="clustered">A value indicating whether the index is clustered.</param>
 /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
 /// <returns><see langword="true" /> if the index can be configured as clustered.</returns>
 public static bool CanSetIsClustered(
     this IConventionIndexBuilder indexBuilder,
     bool?clustered,
     bool fromDataAnnotation = false)
 => indexBuilder.CanSetAnnotation(SqlServerAnnotationNames.Clustered, clustered, fromDataAnnotation);
 /// <summary>
 ///     Returns a value indicating whether the given name can be set for the index.
 /// </summary>
 /// <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> <c>true</c> if the given name can be set for the index. </returns>
 public static bool CanSetName(
     [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] string name, bool fromDataAnnotation = false)
 => indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Name, name, fromDataAnnotation);