Exemple #1
0
        /// <summary>
        ///     Configures the table as temporal.
        /// </summary>
        /// <param name="entityTypeBuilder"> The builder for the entity being configured. </param>
        /// <param name="temporal"> A value indicating whether the table is temporal. </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?IsTemporal(
            this IConventionEntityTypeBuilder entityTypeBuilder,
            bool temporal           = true,
            bool fromDataAnnotation = false)
        {
            if (entityTypeBuilder.CanSetIsTemporal(temporal, fromDataAnnotation))
            {
                entityTypeBuilder.Metadata.SetIsTemporal(temporal, fromDataAnnotation);

                return(entityTypeBuilder);
            }

            return(null);
        }