Exemplo n.º 1
0
        /// <summary>
        /// Sets a value indicating whether the index is created concurrently.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="createdConcurrently">The value to set.</param>
        /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
        public static bool?SetIsCreatedConcurrently(
            this IConventionIndex index, bool?createdConcurrently, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.CreatedConcurrently, createdConcurrently, fromDataAnnotation);

            return(createdConcurrently);
        }
Exemplo n.º 2
0
        /// <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>
        /// <returns> The configured value. </returns>
        public static string SetDatabaseName([NotNull] this IConventionIndex index, [CanBeNull] string name, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(
                RelationalAnnotationNames.Name,
                Check.NullButNotEmpty(name, nameof(name)),
                fromDataAnnotation);

            return(name);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Sets a value indicating whether the index is online.
        /// </summary>
        /// <param name="index"> The index. </param>
        /// <param name="createdOnline"> The value to set. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        /// <returns> The configured value. </returns>
        public static bool?SetIsCreatedOnline(
            [NotNull] this IConventionIndex index, bool?createdOnline, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(
                SqlServerAnnotationNames.CreatedOnline,
                createdOnline,
                fromDataAnnotation);

            return(createdOnline);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Sets a value indicating whether the index is clustered.
        /// </summary>
        /// <param name="value"> The value to set. </param>
        /// <param name="index"> The index. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        /// <returns> The configured value. </returns>
        public static bool?SetIsClustered(
            [NotNull] this IConventionIndex index, bool?value, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(
                SqlServerAnnotationNames.Clustered,
                value,
                fromDataAnnotation);

            return(value);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Sets included property names.
        /// </summary>
        /// <param name="index"> The index. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        /// <param name="properties"> The value to set. </param>
        /// <returns> The configured property names. </returns>
        public static IReadOnlyList <string> SetIncludeProperties(
            [NotNull] this IConventionIndex index, [NotNull] IReadOnlyList <string> properties, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(
                SqlServerAnnotationNames.Include,
                properties,
                fromDataAnnotation);

            return(properties);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Sets the column operators to be used, or <c>null</c> if they have not been specified.
        /// </summary>
        /// <remarks>
        /// https://www.postgresql.org/docs/current/static/indexes-opclass.html
        /// </remarks>
        public static IReadOnlyList <string>?SetOperators(
            this IConventionIndex index,
            IReadOnlyList <string>?operators,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(operators, nameof(operators));

            index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexOperators, operators, fromDataAnnotation);

            return(operators);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Sets the index method to be used, or <c>null</c> if it hasn't been specified.
        /// <c>null</c> selects the default (currently <c>btree</c>).
        /// </summary>
        /// <remarks>
        /// http://www.postgresql.org/docs/current/static/sql-createindex.html
        /// </remarks>
        public static string?SetMethod(
            this IConventionIndex index,
            string?method,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(method, nameof(method));

            index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexMethod, method, fromDataAnnotation);

            return(method);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Sets the index to tsvector config name to be used.
        /// </summary>
        /// <param name="index">The index.</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>
        /// <remarks>
        /// https://www.postgresql.org/docs/current/textsearch-tables.html#TEXTSEARCH-TABLES-INDEX
        /// </remarks>
        public static string?SetTsVectorConfig(
            this IConventionIndex index,
            string?config,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(config, nameof(config));

            index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.TsVectorConfig, config, fromDataAnnotation);

            return(config);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Sets the column NULL sort orders to be used, or <c>null</c> if they have not been specified.
        /// </summary>
        /// <remarks>
        /// https://www.postgresql.org/docs/current/static/indexes-ordering.html
        /// </remarks>
        public static IReadOnlyList <NullSortOrder>?SetNullSortOrder(
            this IConventionIndex index,
            IReadOnlyList <NullSortOrder>?nullSortOrder,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(nullSortOrder, nameof(nullSortOrder));

            index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexNullSortOrder, nullSortOrder, fromDataAnnotation);

            return(nullSortOrder);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Sets the column collations to be used, or <c>null</c> if they have not been specified.
        /// </summary>
        /// <remarks>
        /// https://www.postgresql.org/docs/current/static/indexes-collations.html
        /// </remarks>
        public static IReadOnlyList <string>?SetCollation(
            this IConventionIndex index,
            IReadOnlyList <string>?collations,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(collations, nameof(collations));

            index.SetOrRemoveAnnotation(RelationalAnnotationNames.Collation, collations, fromDataAnnotation);

            return(collations);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Sets the column sort orders to be used, or <c>null</c> if they have not been specified.
        /// </summary>
        /// <remarks>
        /// https://www.postgresql.org/docs/current/static/indexes-ordering.html
        /// </remarks>
        public static IReadOnlyList <SortOrder> SetSortOrder(
            [NotNull] this IConventionIndex index,
            [CanBeNull] IReadOnlyList <SortOrder> sortOrder,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(sortOrder, nameof(sortOrder));

            index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexSortOrder, sortOrder, fromDataAnnotation);

            return(sortOrder);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Sets included property names.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
        /// <param name="properties">The value to set.</param>
        public static IReadOnlyList <string>?SetIncludeProperties(
            this IConventionIndex index,
            IReadOnlyList <string>?properties,
            bool fromDataAnnotation = false)
        {
            Check.NullButNotEmpty(properties, nameof(properties));

            index.SetOrRemoveAnnotation(
                NpgsqlAnnotationNames.IndexInclude,
                properties,
                fromDataAnnotation);

            return(properties);
        }
Exemplo n.º 13
0
        /// <summary>
        ///     Defines a value indicating whether the index uses the fill factor.
        /// </summary>
        /// <param name="index"> The index. </param>
        /// <param name="fillFactor"> The value to set. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        /// <returns> The configured value. </returns>
        public static int?SetFillFactor(
            [NotNull] this IConventionIndex index,
            int?fillFactor,
            bool fromDataAnnotation = false)
        {
            if (fillFactor != null && (fillFactor <= 0 || fillFactor > 100))
            {
                throw new ArgumentOutOfRangeException(nameof(fillFactor));
            }

            index.SetOrRemoveAnnotation(
                SqlServerAnnotationNames.FillFactor,
                fillFactor,
                fromDataAnnotation);

            return(fillFactor);
        }
 /// <summary>
 ///     Sets a value indicating whether the index is full text.
 /// </summary>
 /// <param name="value"> The value to set. </param>
 /// <param name="index"> The index. </param>
 /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
 public static void SetIsFullText(
     [NotNull] this IConventionIndex index, bool?value, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(
     MySQLAnnotationNames.FullTextIndex,
     value,
     fromDataAnnotation);
Exemplo n.º 15
0
        /// <summary>
        ///     Sets a value indicating which full text parser to used.
        /// </summary>
        /// <param name="value"> The value to set. </param>
        /// <param name="index"> The index. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        public static string SetFullTextParser([NotNull] this IConventionIndex index, [CanBeNull] string value, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(MySqlAnnotationNames.FullTextParser, value, fromDataAnnotation);

            return(value);
        }
Exemplo n.º 16
0
        /// <summary>
        ///     Sets a value indicating whether the index is full text.
        /// </summary>
        /// <param name="value"> The value to set. </param>
        /// <param name="index"> The index. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        public static bool?SetIsFullText([NotNull] this IConventionIndex index, bool?value, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(MySqlAnnotationNames.FullTextIndex, value, fromDataAnnotation);

            return(value);
        }
Exemplo n.º 17
0
        /// <summary>
        ///     Sets prefix lengths for the index.
        /// </summary>
        /// <param name="values"> The prefix lengths to set.
        /// A value of `0` indicates, that the full length should be used for that column. </param>
        /// <param name="index"> The index. </param>
        /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
        public static int[] SetPrefixLength([NotNull] this IConventionIndex index, int[] values, bool fromDataAnnotation = false)
        {
            index.SetOrRemoveAnnotation(MySqlAnnotationNames.IndexPrefixLength, values, fromDataAnnotation);

            return(values);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Sets the column collations to be used, or <c>null</c> if they have not been specified.
 /// </summary>
 /// <remarks>
 /// https://www.postgresql.org/docs/current/static/indexes-collations.html
 /// </remarks>
 public static void SetCollation([NotNull] this IConventionIndex index, [CanBeNull] IReadOnlyList <string> collations, bool fromDataAnnotation)
 => index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexCollation, collations, fromDataAnnotation);
Exemplo n.º 19
0
 /// <summary>
 /// Sets the column operators to be used, or <c>null</c> if they have not been specified.
 /// </summary>
 /// <remarks>
 /// https://www.postgresql.org/docs/current/static/indexes-opclass.html
 /// </remarks>
 public static void SetOperators([NotNull] this IConventionIndex index, [CanBeNull] IReadOnlyList <string> operators, bool fromDataAnnotation)
 => index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexOperators, operators, fromDataAnnotation);
Exemplo n.º 20
0
 /// <summary>
 /// Sets the index method to be used, or <c>null</c> if it hasn't been specified.
 /// <c>null</c> selects the default (currently <c>btree</c>).
 /// </summary>
 /// <remarks>
 /// http://www.postgresql.org/docs/current/static/sql-createindex.html
 /// </remarks>
 public static void SetMethod([NotNull] this IConventionIndex index, [CanBeNull] string method, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexMethod, method, fromDataAnnotation);
Exemplo n.º 21
0
 /// <summary>
 /// Sets a value indicating whether the index is created concurrently.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="createdConcurrently">The value to set.</param>
 /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
 public static void SetIsCreatedConcurrently(
     [NotNull] this IConventionIndex index, bool?createdConcurrently, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.CreatedConcurrently, createdConcurrently, fromDataAnnotation);
Exemplo n.º 22
0
 /// <summary>
 /// Sets included property names.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
 /// <param name="properties">The value to set.</param>
 public static void SetIncludeProperties(
     [NotNull] this IConventionIndex index, [NotNull] IReadOnlyList <string> properties, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(
     NpgsqlAnnotationNames.IndexInclude,
     properties,
     fromDataAnnotation);
Exemplo n.º 23
0
 /// <summary>
 /// Sets the column NULL sort orders to be used, or <c>null</c> if they have not been specified.
 /// </summary>
 /// <remarks>
 /// https://www.postgresql.org/docs/current/static/indexes-ordering.html
 /// </remarks>
 public static void SetNullSortOrder([NotNull] this IConventionIndex index,
                                     [CanBeNull] IReadOnlyList <NullSortOrder> nullSortOrder, bool fromDataAnnotation)
 => index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexNullSortOrder, nullSortOrder, fromDataAnnotation);
 /// <summary>
 ///     Sets a value indicating whether the index is clustered.
 /// </summary>
 /// <param name="value"> The value to set. </param>
 /// <param name="index"> The index. </param>
 /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
 public static void SetSqlServerIsClustered(
     [NotNull] this IConventionIndex index, bool?value, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(
     SqlServerAnnotationNames.Clustered,
     value,
     fromDataAnnotation);
 /// <summary>
 ///     Sets a value indicating whether the index is online.
 /// </summary>
 /// <param name="index"> The index. </param>
 /// <param name="createdOnline"> The value to set. </param>
 /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
 public static void SetSqlServerIsCreatedOnline(
     [NotNull] this IConventionIndex index, bool?createdOnline, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(
     SqlServerAnnotationNames.CreatedOnline,
     createdOnline,
     fromDataAnnotation);
Exemplo n.º 26
0
 /// <summary>
 ///     Sets the index filter expression.
 /// </summary>
 /// <param name="index"> The index. </param>
 /// <param name="value"> The value to set. </param>
 /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
 public static void SetFilter([NotNull] this IConventionIndex index, [CanBeNull] string value, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(
     RelationalAnnotationNames.Filter,
     Check.NullButNotEmpty(value, nameof(value)),
     fromDataAnnotation);
 /// <summary>
 ///     Sets a value indicating whether the index is spartial.
 /// </summary>
 /// <param name="value"> The value to set. </param>
 /// <param name="index"> The index. </param>
 /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
 public static void SetIsSpatial(
     [NotNull] this IConventionIndex index, bool?value, bool fromDataAnnotation = false)
 => index.SetOrRemoveAnnotation(
     MySqlAnnotationNames.SpatialIndex,
     value,
     fromDataAnnotation);