예제 #1
0
        /// <summary>
        /// Configures the charset for the property's column.
        /// </summary>
        /// <param name="propertyBuilder">The builder for the property being configured.</param>
        /// <param name="charSet">The name of the charset to configure for the property's 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 HasCharSet(
            this IConventionPropertyBuilder propertyBuilder,
            string charSet,
            bool fromDataAnnotation = false)
        {
            if (!propertyBuilder.CanSetCharSet(charSet, fromDataAnnotation))
            {
                return(null);
            }

            propertyBuilder.Metadata.SetCharSet(charSet, fromDataAnnotation);
            return(propertyBuilder);
        }