/// <summary> /// Sets the custom <see cref="ValueComparer" /> for this property when performing key comparisons. /// </summary> /// <param name="property"> The property. </param> /// <param name="comparer"> The comparer, or <c>null</c> to remove any previously set comparer. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetKeyValueComparer( [NotNull] this IConventionProperty property, [CanBeNull] ValueComparer comparer, bool fromDataAnnotation = false) => property.AsProperty().SetKeyValueComparer( comparer, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary> /// Sets the maximum length of data that is allowed in this property. For example, if the property is a <see cref="string" /> ' /// then this is the maximum number of characters. /// </summary> /// <param name="property"> The property to set the maximum length of. </param> /// <param name="maxLength"> The maximum length of data that is allowed in this property. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetMaxLength([NotNull] this IConventionProperty property, int?maxLength, bool fromDataAnnotation = false) => property.AsProperty().SetMaxLength( maxLength, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary> /// <para> /// Sets the factory to use for generating values for this property, or <c>null</c> to clear any previously set factory. /// </para> /// <para> /// Setting <c>null</c> does not disable value generation for this property, it just clears any generator explicitly /// configured for this property. The database provider may still have a value generator for the property type. /// </para> /// </summary> /// <param name="property"> The property to set the value generator for. </param> /// <param name="valueGeneratorFactory"> /// A factory that will be used to create the value generator, or <c>null</c> to /// clear any previously set factory. /// </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetValueGeneratorFactory( [NotNull] this IConventionProperty property, [NotNull] Func <IProperty, IEntityType, ValueGenerator> valueGeneratorFactory, bool fromDataAnnotation = false) => property.AsProperty().SetValueGeneratorFactory( valueGeneratorFactory, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary> /// Sets the type that the property value will be converted to before being sent to the database provider. /// </summary> /// <param name="property"> The property. </param> /// <param name="providerClrType"> The type to use, or <c>null</c> to remove any previously set type. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetProviderClrType( [NotNull] this IConventionProperty property, [CanBeNull] Type providerClrType, bool fromDataAnnotation = false) => property.AsProperty().SetProviderClrType( providerClrType, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary> /// <para> /// Sets a value indicating whether this property can be modified after the entity is /// saved to the database. /// </para> /// <para> /// If <see cref="PropertySaveBehavior.Throw" />, then an exception /// will be thrown if a new value is assigned to this property after the entity exists in the database. /// </para> /// <para> /// If <see cref="PropertySaveBehavior.Ignore" />, then any modification to the /// property value of an entity that already exists in the database will be ignored. /// </para> /// </summary> /// <param name="property"> The property. </param> /// <param name="afterSaveBehavior"> /// Sets a value indicating whether this property can be modified after the entity is /// saved to the database. <c>null</c> to reset to default. /// </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetAfterSaveBehavior( [NotNull] this IConventionProperty property, PropertySaveBehavior?afterSaveBehavior, bool fromDataAnnotation = false) => property.AsProperty().SetAfterSaveBehavior( afterSaveBehavior, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary> /// Sets a value indicating whether this property can persist Unicode characters. /// </summary> /// <param name="property"> The property to set the value for. </param> /// <param name="unicode"> /// <c>true</c> if the property accepts Unicode characters, <c>false</c> if it does not, <c>null</c> to clear the setting. /// </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetIsUnicode([NotNull] this IConventionProperty property, bool?unicode, bool fromDataAnnotation = false) => property.AsProperty().SetIsUnicode( unicode, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
public static PropertySaveBehavior?SetBeforeSaveBehavior( [NotNull] this IConventionProperty property, PropertySaveBehavior?beforeSaveBehavior, bool fromDataAnnotation = false) => property.AsProperty().SetBeforeSaveBehavior( beforeSaveBehavior, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
public static int?SetScale([NotNull] this IConventionProperty property, int?scale, bool fromDataAnnotation = false) => property.AsProperty().SetScale( scale, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
public static int?SetPrecision([NotNull] this IConventionProperty property, int?precision, bool fromDataAnnotation = false) => property.AsProperty().SetPrecision( precision, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);