/// <summary> /// Returns a value indicating whether the given name and schema can be set for the hi-lo sequence. /// </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. /// </remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="name">The name of the sequence.</param> /// <param name="schema">The schema of the sequence.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns><see langword="true" /> if the given name and schema can be set for the hi-lo sequence.</returns> public static bool CanSetHiLoSequence( this IConventionPropertyBuilder propertyBuilder, string?name, string?schema, bool fromDataAnnotation = false) { Check.NullButNotEmpty(name, nameof(name)); Check.NullButNotEmpty(schema, nameof(schema)); return(propertyBuilder.CanSetAnnotation(SqlServerAnnotationNames.HiLoSequenceName, name, fromDataAnnotation) && propertyBuilder.CanSetAnnotation(SqlServerAnnotationNames.HiLoSequenceSchema, schema, fromDataAnnotation)); }
/// <summary> /// Returns a value indicating whether the given name and schema can be set for the hi-lo sequence. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured.</param> /// <param name="name"> The name of the sequence.</param> /// <param name="schema">The schema of the sequence.</param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation.</param> /// <returns><c>true</c> if the given name and schema can be set for the hi-lo sequence.</returns> public static bool CanSetHiLoSequence( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string name, [CanBeNull] string schema, bool fromDataAnnotation = false) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); Check.NullButNotEmpty(name, nameof(name)); Check.NullButNotEmpty(schema, nameof(schema)); return(propertyBuilder.CanSetAnnotation(NpgsqlAnnotationNames.HiLoSequenceName, name, fromDataAnnotation) && propertyBuilder.CanSetAnnotation(NpgsqlAnnotationNames.HiLoSequenceSchema, schema, fromDataAnnotation)); }
/// <summary> /// Returns a value indicating whether the given value can be set as the increment for SQL Server IDENTITY. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="increment"> The incremental value that is added to the identity value of the previous row that was loaded. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <c>true</c> if the given value can be set as the default increment for SQL Server IDENTITY. </returns> public static bool CanSetIdentityColumnIncrement( [NotNull] this IConventionPropertyBuilder propertyBuilder, int?increment, bool fromDataAnnotation = false) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); return(propertyBuilder.CanSetAnnotation(SqlServerAnnotationNames.IdentityIncrement, increment, fromDataAnnotation)); }
/// <summary> /// Configures the value generation strategy for the key property, when targeting SQL Server. /// </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. /// </remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="valueGenerationStrategy">The value generation strategy.</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, /// <see langword="null" /> otherwise. /// </returns> public static IConventionPropertyBuilder?HasValueGenerationStrategy( this IConventionPropertyBuilder propertyBuilder, SqlServerValueGenerationStrategy?valueGenerationStrategy, bool fromDataAnnotation = false) { if (propertyBuilder.CanSetAnnotation( SqlServerAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { propertyBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); if (valueGenerationStrategy != SqlServerValueGenerationStrategy.IdentityColumn) { propertyBuilder.HasIdentityColumnSeed(null, fromDataAnnotation); propertyBuilder.HasIdentityColumnIncrement(null, fromDataAnnotation); } if (valueGenerationStrategy != SqlServerValueGenerationStrategy.SequenceHiLo) { propertyBuilder.HasHiLoSequence(null, null, fromDataAnnotation); } return(propertyBuilder); } return(null); }
/// <summary> /// Returns a value indicating whether the given value can be set as the seed for Jet IDENTITY. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="seed"> The value that is used for the very first row loaded into the table. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <c>true</c> if the given value can be set as the seed for Jet IDENTITY. </returns> public static bool CanSetIdentityColumnSeed( [NotNull] this IConventionPropertyBuilder propertyBuilder, int?seed, bool fromDataAnnotation = false) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); return(propertyBuilder.CanSetAnnotation(JetAnnotationNames.IdentitySeed, seed, fromDataAnnotation)); }
/// <summary> /// Returns a value indicating whether the given default value expression can be set for the column. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="sql"> The SQL expression for the default value of the column. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <c>true</c> if the given default value expression can be set for the column. </returns> public static bool CanSetDefaultValueSql( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string sql, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( RelationalAnnotationNames.DefaultValueSql, Check.NullButNotEmpty(sql, nameof(sql)), fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given value can be set as comment for the column. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="comment"> The comment for the column. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given value can be set as default for the column. </returns> public static bool CanSetComment( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string comment, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( RelationalAnnotationNames.Comment, comment, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given value can be set as default for the column. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="value"> The default value of the column. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given value can be set as default for the column. </returns> public static bool CanSetDefaultValue( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] object value, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( RelationalAnnotationNames.DefaultValue, value, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given value can be set as the SRID for the column. /// </summary> /// <remarks> /// See <see href="https://aka.ms/efcore-docs-spatial">Spatial data</see>, and /// <see href="https://aka.ms/efcore-docs-sqlite">Accessing SQLite databases with EF Core</see> for more information and examples. /// </remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="srid">The SRID.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns><see langword="true" /> if the given value can be set as the SRID for the column.</returns> public static bool CanSetSrid( this IConventionPropertyBuilder propertyBuilder, int?srid, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( SqliteAnnotationNames.Srid, srid, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given computed value SQL expression can be set for the column. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="sql"> The SQL expression that computes values for the column. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given computed value SQL expression can be set for the column. </returns> public static bool CanSetComputedColumnSql( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string sql, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( RelationalAnnotationNames.ComputedColumnSql, sql, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given computed column type can be set for the column. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="stored"> /// If <see langword="true" />, the computed value is calculated on row modification and stored in the database like a regular column. /// If <see langword="false" />, the value is computed when the value is read, and does not occupy any actual storage. /// <see langword="null" /> selects the database provider default. /// </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given computed column type can be set for the column. </returns> public static bool CanSetIsStoredComputedColumn( [NotNull] this IConventionPropertyBuilder propertyBuilder, bool?stored, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( RelationalAnnotationNames.IsStored, stored, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given value can be set as the value generation strategy. /// </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. /// </remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="valueGenerationStrategy">The value generation strategy.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns><see langword="true" /> if the given value can be set as the default value generation strategy.</returns> public static bool CanSetValueGenerationStrategy( this IConventionPropertyBuilder propertyBuilder, SqlServerValueGenerationStrategy?valueGenerationStrategy, bool fromDataAnnotation = false) => (valueGenerationStrategy == null || SqlServerPropertyExtensions.IsCompatibleWithValueGeneration(propertyBuilder.Metadata)) && propertyBuilder.CanSetAnnotation( SqlServerAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the MySQL character set can be set on the column associated with this property. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="charSet"> The name of the character set. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given value can be set as the character set for the column. </returns> public static bool CanSetCharSet( this IConventionPropertyBuilder propertyBuilder, string charSet, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation( MySqlAnnotationNames.CharSet, charSet, fromDataAnnotation);
/// <summary> /// Whether the compression method for the column can be set. /// </summary> /// <remarks>This feature was introduced in PostgreSQL 14.</remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="compressionMethod">The compression method.</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 CanSetCompressionMethod( this IConventionPropertyBuilder propertyBuilder, string?compressionMethod, bool fromDataAnnotation = false) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); return(propertyBuilder.CanSetAnnotation(NpgsqlAnnotationNames.CompressionMethod, compressionMethod, fromDataAnnotation)); }
/// <summary> /// Returns a value indicating whether the property's column can be configured as sparse when targeting SQL Server. /// </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. /// </remarks> /// <param name="property">The builder for the property being configured.</param> /// <param name="sparse">A value indicating whether the property's column is created as sparse.</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, <see langword="null" /> otherwise.</returns> /// <returns> /// <see langword="true" /> if the property's column can be configured as sparse when targeting SQL Server. /// </returns> /// <remarks> See https://docs.microsoft.com/sql/relational-databases/tables/use-sparse-columns. </remarks> public static bool CanSetIsSparse( this IConventionPropertyBuilder property, bool?sparse, bool fromDataAnnotation = false) { Check.NotNull(property, nameof(property)); return(property.CanSetAnnotation(SqlServerAnnotationNames.Sparse, sparse, fromDataAnnotation)); }
/// <summary> /// Returns a value indicating whether the given value can be set as the collation. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="collation"> The collation. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given value can be set as default for the column. </returns> public static bool CanSetCollation( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string collation, bool fromDataAnnotation = false) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); return(propertyBuilder.CanSetAnnotation(RelationalAnnotationNames.Collation, collation, fromDataAnnotation)); }
/// <summary> /// Returns a value indicating whether the given value can be set as the value generation strategy. /// </summary> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="valueGenerationStrategy">The value generation strategy.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns><c>true</c> if the given value can be set as the default value generation strategy.</returns> public static bool CanSetValueGenerationStrategy( [NotNull] this IConventionPropertyBuilder propertyBuilder, NpgsqlValueGenerationStrategy?valueGenerationStrategy, bool fromDataAnnotation = false) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); return((valueGenerationStrategy == null || NpgsqlPropertyExtensions.IsCompatibleWithValueGeneration(propertyBuilder.Metadata)) && propertyBuilder.CanSetAnnotation( NpgsqlAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)); }
public static IConventionPropertyBuilder HasValueGenerationStrategy(this IConventionPropertyBuilder propertyBuilder, FbValueGenerationStrategy?valueGenerationStrategy, bool fromDataAnnotation = false) { if (propertyBuilder.CanSetAnnotation(FbAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { propertyBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); if (valueGenerationStrategy != FbValueGenerationStrategy.IdentityColumn) { } if (valueGenerationStrategy != FbValueGenerationStrategy.SequenceTrigger) { } return(propertyBuilder); } return(null); }
/// <summary> /// Configures the value generation strategy for the key property, when targeting PostgreSQL. /// </summary> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="valueGenerationStrategy">The value generation strategy.</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> public static IConventionPropertyBuilder HasValueGenerationStrategy( [NotNull] this IConventionPropertyBuilder propertyBuilder, NpgsqlValueGenerationStrategy?valueGenerationStrategy, bool fromDataAnnotation = false) { if (propertyBuilder.CanSetAnnotation( NpgsqlAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { propertyBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); if (valueGenerationStrategy != NpgsqlValueGenerationStrategy.SequenceHiLo) { propertyBuilder.HasHiLoSequence(null, null, fromDataAnnotation); } return(propertyBuilder); } return(null); }
/// <summary> /// Configures the value generation strategy for the key property, when targeting Jet. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="valueGenerationStrategy"> The value generation strategy. </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> public static IConventionPropertyBuilder HasValueGenerationStrategy( [NotNull] this IConventionPropertyBuilder propertyBuilder, JetValueGenerationStrategy?valueGenerationStrategy, bool fromDataAnnotation = false) { if (propertyBuilder.CanSetAnnotation( JetAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { propertyBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); if (valueGenerationStrategy != JetValueGenerationStrategy.IdentityColumn) { propertyBuilder.HasIdentityColumnSeed(null, fromDataAnnotation); propertyBuilder.HasIdentityColumnIncrement(null, fromDataAnnotation); } return(propertyBuilder); } return(null); }
/// <summary> /// Returns a value indicating whether the sequence options can be set on the identity column. /// </summary> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="startValue"> /// The starting value for the sequence. /// The default starting value is <see cref="minValue"/> for ascending sequences and <see cref="maxValue"/> for descending ones. /// </param> /// <param name="incrementBy">The amount to increment between values. Defaults to 1.</param> /// <param name="minValue"> /// The minimum value for the sequence. /// The default for an ascending sequence is 1. The default for a descending sequence is the minimum value of the data type. /// </param> /// <param name="maxValue"> /// The maximum value for the sequence. /// The default for an ascending sequence is the maximum value of the data type. The default for a descending sequence is -1. /// </param> /// <param name="cyclic"> /// Sets whether or not the sequence will start again from the beginning once the maximum value is reached. /// Defaults to false. /// </param> /// <param name="numbersToCache"> /// Specifies how many sequence numbers are to be preallocated and stored in memory for faster access. /// The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and this is also the default. /// </param> /// <returns>The same builder instance so that multiple calls can be chained.</returns> public static bool CanSetIdentityOptions( [NotNull] this IConventionPropertyBuilder propertyBuilder, long?startValue = null, long?incrementBy = null, long?minValue = null, long?maxValue = null, bool?cyclic = null, long?numbersToCache = null) { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); var value = new IdentitySequenceOptionsData { StartValue = startValue, IncrementBy = incrementBy ?? 1, MinValue = minValue, MaxValue = maxValue, IsCyclic = cyclic ?? false, NumbersToCache = numbersToCache ?? 1 }.Serialize(); return(propertyBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IdentityOptions, value)); }
/// <summary> /// Returns a value indicating whether the property's column can be configured as sparse when targeting SQL Server. /// </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. /// </remarks> /// <param name="property">The builder for the property being configured.</param> /// <param name="sparse">A value indicating whether the property's column is created as sparse.</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, <see langword="null" /> otherwise.</returns> /// <returns> /// <see langword="true" /> if the property's column can be configured as sparse when targeting SQL Server. /// </returns> /// <remarks> See https://docs.microsoft.com/sql/relational-databases/tables/use-sparse-columns. </remarks> public static bool CanSetIsSparse( this IConventionPropertyBuilder property, bool?sparse, bool fromDataAnnotation = false) => property.CanSetAnnotation(SqlServerAnnotationNames.Sparse, sparse, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given property name can be set. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="name"> The name of the property. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <c>true</c> if the property name can be set. </returns> public static bool CanSetJsonProperty( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string name, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation(CosmosAnnotationNames.PropertyName, name, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given value can be set as the seed for SQL Server IDENTITY. /// </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. /// </remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="seed">The value that is used for the very first row loaded into the table.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns><see langword="true" /> if the given value can be set as the seed for SQL Server IDENTITY.</returns> public static bool CanSetIdentityColumnSeed( this IConventionPropertyBuilder propertyBuilder, long?seed, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation(SqlServerAnnotationNames.IdentitySeed, seed, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given value can be set as the increment for SQL Server IDENTITY. /// </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. /// </remarks> /// <param name="propertyBuilder">The builder for the property being configured.</param> /// <param name="increment">The incremental value that is added to the identity value of the previous row that was loaded.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns><see langword="true" /> if the given value can be set as the default increment for SQL Server IDENTITY.</returns> public static bool CanSetIdentityColumnIncrement( this IConventionPropertyBuilder propertyBuilder, int?increment, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation(SqlServerAnnotationNames.IdentityIncrement, increment, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the given data type can be set for the property. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="typeName"> The name of the data type of the column. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the given data type can be set for the property. </returns> public static bool CanSetColumnType( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string typeName, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation(RelationalAnnotationNames.ColumnType, typeName, fromDataAnnotation);
/// <summary> /// Returns a value indicating whether the property can be configured as being fixed length or not. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="fixedLength"> A value indicating whether the property is constrained to fixed length values. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> <see langword="true" /> if the property can be configured as being fixed length or not. </returns> public static bool CanSetIsFixedLength( [NotNull] this IConventionPropertyBuilder propertyBuilder, bool?fixedLength, bool fromDataAnnotation = false) => propertyBuilder.CanSetAnnotation(RelationalAnnotationNames.IsFixedLength, fixedLength, fromDataAnnotation);