示例#1
0
        /// <summary>
        ///     Configures a history table name for the entity mapped to a temporal table.
        /// </summary>
        /// <param name="entityTypeBuilder"> The builder for the entity being configured. </param>
        /// <param name="name"> The name of the history table. </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 IConventionEntityTypeBuilder?WithHistoryTableName(
            this IConventionEntityTypeBuilder entityTypeBuilder,
            string name,
            bool fromDataAnnotation = false)
        {
            if (entityTypeBuilder.CanSetHistoryTableName(name, fromDataAnnotation))
            {
                entityTypeBuilder.Metadata.SetTemporalHistoryTableName(name, fromDataAnnotation);

                return(entityTypeBuilder);
            }

            return(null);
        }