예제 #1
0
        /// <summary>
        ///     Configures the table that the entity maps to when targeting SQL Server as memory-optimized.
        /// </summary>
        /// <param name="entityTypeBuilder"> The builder for the entity type being configured. </param>
        /// <param name="memoryOptimized"> A value indicating whether the table is memory-optimized. </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,
        ///     <c>null</c> otherwise.
        /// </returns>
        public static IConventionEntityTypeBuilder ForSqlServerIsMemoryOptimized(
            [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder,
            bool?memoryOptimized,
            bool fromDataAnnotation = false)
        {
            if (entityTypeBuilder.ForSqlServerCanSetIsMemoryOptimized(memoryOptimized, fromDataAnnotation))
            {
                entityTypeBuilder.Metadata.SetSqlServerIsMemoryOptimized(memoryOptimized, fromDataAnnotation);
                return(entityTypeBuilder);
            }

            return(null);
        }