/// <summary> /// Configures the column that the property maps to when targeting a relational database. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="name"> The name of the column. </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 HasColumnName( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string name, bool fromDataAnnotation = false) { if (!propertyBuilder.CanSetColumnName(name, fromDataAnnotation)) { return(null); } propertyBuilder.Metadata.SetColumnName(name, fromDataAnnotation); return(propertyBuilder); }
/// <summary> /// Configures the column that the property maps to when targeting a relational database. /// </summary> /// <param name="propertyBuilder"> The builder for the property being configured. </param> /// <param name="name"> The name of the column. </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? HasColumnName( this IConventionPropertyBuilder propertyBuilder, string? name, bool fromDataAnnotation = false) { if (!propertyBuilder.CanSetColumnName(name, fromDataAnnotation)) { return null; } propertyBuilder.Metadata.SetColumnName(name, fromDataAnnotation); return propertyBuilder; }