/// <summary> /// Sets the MySQL character set on the table associated with this entity. When you only specify the character set, MySQL implicitly /// uses its default collation. /// </summary> /// <param name="entityTypeBuilder"> The builder for the entity type being configured. </param> /// <param name="charSet"> The name of the character set. </param> /// <param name="delegationModes"> /// Finely controls where to recursively apply the character set and where not (including this entity/table). /// Implicitly uses <see cref="DelegationModes.ApplyToAll"/> if set to <see langword="null"/>. /// </param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns> The same builder instance so that multiple calls can be chained. </returns> public static IConventionEntityTypeBuilder HasCharSet( [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder, [CanBeNull] string charSet, DelegationModes?delegationModes = null, bool fromDataAnnotation = false) { Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder)); Check.NullButNotEmpty(charSet, nameof(charSet)); Check.NullOrEnumValue(delegationModes, nameof(delegationModes)); if (entityTypeBuilder.CanSetCharSet(charSet, fromDataAnnotation) && entityTypeBuilder.CanSetCharSetDelegation(delegationModes, fromDataAnnotation)) { entityTypeBuilder.Metadata.SetCharSet(charSet, fromDataAnnotation); entityTypeBuilder.Metadata.SetCharSetDelegation(delegationModes, fromDataAnnotation); return(entityTypeBuilder); } return(null); }