/// <summary> /// Sets the discriminator value for this entity type. /// </summary> /// <param name="entityType"> The entity type to set the discriminator value for. </param> /// <param name="value"> The value to set. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetDiscriminatorValue( [NotNull] this IConventionEntityType entityType, [CanBeNull] object value, bool fromDataAnnotation = false) { entityType.AsEntityType().CheckDiscriminatorValue(entityType, value); entityType.SetAnnotation(CoreAnnotationNames.DiscriminatorValue, value, fromDataAnnotation); }
/// <summary> /// Adds a property to this entity. /// </summary> /// <param name="entityType"> The entity type to add the property to. </param> /// <param name="propertyInfo"> The corresponding property in the entity class. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> The newly created property. </returns> public static IConventionProperty AddProperty( [NotNull] this IConventionEntityType entityType, [NotNull] PropertyInfo propertyInfo, bool fromDataAnnotation = false) { Check.NotNull(entityType, nameof(entityType)); Check.NotNull(propertyInfo, nameof(propertyInfo)); return(entityType.AsEntityType().AddProperty( propertyInfo, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention)); }