/// <summary> /// Configures the property to map to a computed column when targeting a relational database. /// </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> /// The same builder instance if the configuration was applied, /// <see langword="null" /> otherwise. /// </returns> public static IConventionPropertyBuilder HasComputedColumnSql( [NotNull] this IConventionPropertyBuilder propertyBuilder, [CanBeNull] string sql, bool fromDataAnnotation = false) { if (!propertyBuilder.CanSetComputedColumnSql(sql, fromDataAnnotation)) { return(null); } propertyBuilder.Metadata.SetComputedColumnSql(sql, fromDataAnnotation); return(propertyBuilder); }