/// <summary> /// Configures the scalar as capable of storing only fixed-length data, such as strings. /// </summary> /// <remarks> /// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information. /// </remarks> /// <param name="scalarBuilder">The builder for the scalar being configured.</param> /// <param name="fixedLength">A value indicating whether the scalar is constrained to fixed length values.</param> /// <returns>The same builder instance so that multiple configuration calls can be chained.</returns> public static TypeMappingConfigurationBuilder IsFixedLength( this TypeMappingConfigurationBuilder scalarBuilder, bool fixedLength = true) { scalarBuilder.HasAnnotation(RelationalAnnotationNames.IsFixedLength, fixedLength); return(scalarBuilder); }
/// <summary> /// Configures the data type of the column that the scalar maps to when targeting a relational database. /// This should be the complete type name, including precision, scale, length, etc. /// </summary> /// <remarks> /// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information. /// </remarks> /// <param name="scalarBuilder">The builder for the scalar being configured.</param> /// <param name="typeName">The name of the data type of the column.</param> /// <returns>The same builder instance so that multiple calls can be chained.</returns> public static TypeMappingConfigurationBuilder HasColumnType( this TypeMappingConfigurationBuilder scalarBuilder, string typeName) { Check.NotEmpty(typeName, nameof(typeName)); scalarBuilder.HasAnnotation(RelationalAnnotationNames.ColumnType, typeName); return(scalarBuilder); }