예제 #1
0
        /// <summary>
        ///     Configures a history table schema for the entity mapped to a temporal table.
        /// </summary>
        /// <param name="entityTypeBuilder"> The builder for the entity being configured. </param>
        /// <param name="schema"> The schema 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?WithHistoryTableSchema(
            this IConventionEntityTypeBuilder entityTypeBuilder,
            string?schema,
            bool fromDataAnnotation = false)
        {
            if (entityTypeBuilder.CanSetHistoryTableSchema(schema, fromDataAnnotation))
            {
                entityTypeBuilder.Metadata.SetTemporalHistoryTableSchema(schema, fromDataAnnotation);

                return(entityTypeBuilder);
            }

            return(null);
        }