Exemplo n.º 1
0
        /// <summary>
        ///     Configures the maximum length allowed for store identifiers.
        /// </summary>
        /// <param name="modelBuilder"> The model builder. </param>
        /// <param name="length"> The value to set. </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 IConventionModelBuilder HasMaxIdentifierLength(
            [NotNull] this IConventionModelBuilder modelBuilder,
            int?length,
            bool fromDataAnnotation = false)
        {
            if (modelBuilder.CanSetMaxIdentifierLength(length, fromDataAnnotation))
            {
                modelBuilder.Metadata.SetMaxIdentifierLength(length, fromDataAnnotation);

                return(modelBuilder);
            }

            return(null);
        }